tsql

package
v1.0.54 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 25, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BatchInsert added in v1.0.32

func BatchInsert[T any](db *gorm.DB, table string, values []*T) (int64, error)

func Delete added in v1.0.32

func Delete[T any](db *gorm.DB, table string, condition map[string]interface{}) (int64, error)

func ExecuteRaw added in v1.0.32

func ExecuteRaw(db *gorm.DB, raw string, values ...interface{}) error

func Insert added in v1.0.32

func Insert[T any](db *gorm.DB, table string, value *T) (int64, error)

func IsNotFoundErr added in v1.0.1

func IsNotFoundErr(err error) bool

func JSONArray added in v1.0.32

func JSONArray(v interface{}, isNil bool) (driver.Value, error)

JSONArray returns the JSON encoding of v array.

func JSONObject added in v1.0.39

func JSONObject(v interface{}, isNil bool) (driver.Value, error)

JSONObject returns the JSON encoding of v object.

func JSONScan added in v1.0.32

func JSONScan(value, v interface{}) error

JSONScan parses the JSON-encoded data and stores the result in the value pointed to by v.

func Select added in v1.0.32

func Select[T any](db *gorm.DB, table string, condition map[string]interface{}) ([]T, error)

func SelectAll

func SelectAll[T any](data T, prefix ...string) string

SelectAll 生成select a, b, c, d 前缀

func SelectById added in v1.0.32

func SelectById[T any](db *gorm.DB, table string, id int64, columns ...string) (T, error)

func SelectPluck added in v1.0.32

func SelectPluck[T any, K any](db *gorm.DB, table string, condition map[string]interface{}, column string) ([]K, error)

func SelectRaw added in v1.0.32

func SelectRaw[T any](db *gorm.DB, raw string, values ...interface{}) ([]T, error)

func Update added in v1.0.32

func Update[T any](db *gorm.DB, table string, condition map[string]interface{}, values map[string]interface{}) (int64, error)

Types

type IntStringMap added in v1.0.39

type IntStringMap map[int64]string

IntStringMap db column value type.

func (*IntStringMap) Scan added in v1.0.39

func (s *IntStringMap) Scan(value interface{}) error

Scan implements the sql.Scanner interface.

func (IntStringMap) Value added in v1.0.39

func (s IntStringMap) Value() (driver.Value, error)

Value implements the driver.Valuer interface.

type SecTimestamp

type SecTimestamp int64

SecTimestamp 用于mysql的秒时间戳类型

func NewSecTimestamp

func NewSecTimestamp(t time.Time) SecTimestamp

func (*SecTimestamp) Scan

func (s *SecTimestamp) Scan(src interface{}) error

func (*SecTimestamp) Time

func (s *SecTimestamp) Time() time.Time

func (*SecTimestamp) Value

func (s *SecTimestamp) Value() (driver.Value, error)

type Strings added in v1.0.32

type Strings []string

Strings db column value type.

func (*Strings) Scan added in v1.0.32

func (s *Strings) Scan(value interface{}) error

Scan implements the sql.Scanner interface.

func (Strings) Value added in v1.0.32

func (s Strings) Value() (driver.Value, error)

Value implements the driver.Valuer interface.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL