operator

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetListStructType

func GetListStructType(list interface{}) reflect.Type

func GetSqlValue

func GetSqlValue(columnType *sql.ColumnType, data interface{}) (value interface{})

func SetStructColumnValues

func SetStructColumnValues(columnValueMap map[string]interface{}, strValue reflect.Value, dia dialect.Dialect)

Types

type Operator

type Operator interface {
	Exec(ctx context.Context, db *sql.DB, dia dialect.Dialect, sqlInfo string, args []interface{}) (resultList sql.Result, err error)
	ExecTx(ctx context.Context, tx *sql.Tx, dia dialect.Dialect, sqlInfo string, args []interface{}) (resultList sql.Result, err error)
	Query(ctx context.Context, db *sql.DB, dia dialect.Dialect, sqlInfo string, args []interface{}, list interface{}, depth int) (err error)
	QueryRowContext(ctx context.Context, db *sql.DB, dia dialect.Dialect, sqlInfo string, args []interface{}) *sql.Row
	QueryPagination(ctx context.Context, db *sql.DB, dia dialect.Dialect, sqlInfo string, args []interface{}, limit, offset int, list interface{}) (err error)
}

func NewOpt

func NewOpt() Operator

type Opt

type Opt struct {
}

func (*Opt) Exec

func (o *Opt) Exec(ctx context.Context, db *sql.DB, dia dialect.Dialect, sqlInfo string, args []interface{}) (resultList sql.Result, err error)

func (*Opt) ExecTx

func (o *Opt) ExecTx(ctx context.Context, tx *sql.Tx, dia dialect.Dialect, sqlInfo string, args []interface{}) (resultList sql.Result, err error)

func (*Opt) Query

func (o *Opt) Query(ctx context.Context, db *sql.DB, dia dialect.Dialect, sqlInfo string, args []interface{}, list interface{}, depth int) (err error)

直接查询

func (*Opt) QueryPagination

func (o *Opt) QueryPagination(ctx context.Context, db *sql.DB, dia dialect.Dialect, sqlInfo string, args []interface{}, limit, offset int, list interface{}) (err error)

通过limit offset查询

func (*Opt) QueryRowContext

func (o *Opt) QueryRowContext(ctx context.Context, db *sql.DB, dia dialect.Dialect, sqlInfo string, args []interface{}) *sql.Row

Jump to

Keyboard shortcuts

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