Documentation ¶
Index ¶
- Constants
- Variables
- func Exec(ctx context.Context, db Executor, expr string, args ...interface{}) (sql.Result, error)
- func ExecB(ctx context.Context, db Executor, b sqlbuilder.Builder) (sql.Result, error)
- func GetBool(ctx context.Context, db Executor, b sqlbuilder.Builder) (bool, error)
- func GetCount(ctx context.Context, db Executor, b sqlbuilder.Builder) (int64, error)
- func GetFloat64(ctx context.Context, db Executor, b sqlbuilder.Builder) (float64, error)
- func GetInt(ctx context.Context, db Executor, b sqlbuilder.Builder) (int, error)
- func GetInt64(ctx context.Context, db Executor, b sqlbuilder.Builder) (int64, error)
- func GetString(ctx context.Context, db Executor, b sqlbuilder.Builder) (string, error)
- func GetStruct(ctx context.Context, db Executor, out interface{}, b sqlbuilder.Builder) error
- func GetTagStruct(ctx context.Context, db Executor, tag string, out interface{}, ...) error
- func PullBools(ctx context.Context, db Executor, b sqlbuilder.Builder) ([]bool, error)
- func PullFloat64s(ctx context.Context, db Executor, b sqlbuilder.Builder) ([]float64, error)
- func PullInt64s(ctx context.Context, db Executor, b sqlbuilder.Builder) ([]int64, error)
- func PullInts(ctx context.Context, db Executor, b sqlbuilder.Builder) ([]int, error)
- func PullStrings(ctx context.Context, db Executor, b sqlbuilder.Builder) ([]string, error)
- func PullStructs(ctx context.Context, db Executor, out interface{}, b sqlbuilder.Builder) error
- func PullTagStructs(ctx context.Context, db Executor, tag string, out interface{}, ...) error
- func Query(ctx context.Context, db Executor, expr string, args ...interface{}) (*sql.Rows, error)
- func QueryB(ctx context.Context, db Executor, b sqlbuilder.Builder) (*sql.Rows, error)
- func QueryRow(ctx context.Context, db Executor, expr string, args ...interface{}) *sql.Row
- func QueryRowB(ctx context.Context, db Executor, b sqlbuilder.Builder) *sql.Row
- func TxWrapper(ctx context.Context, db *sql.DB, opts *sql.TxOptions, callback TxCallback) error
- type Cond
- type CondFunc
- type DelCond
- type DelCondFunc
- type Executor
- type Struct
- func (s *Struct) Exec(ctx context.Context, db Executor, expr string, args ...interface{}) (sql.Result, error)
- func (s *Struct) ExecB(ctx context.Context, db Executor, b sqlbuilder.Builder) (sql.Result, error)
- func (s *Struct) Query(ctx context.Context, db Executor, result interface{}, expr string, ...) error
- func (s *Struct) QueryB(ctx context.Context, db Executor, result interface{}, b sqlbuilder.Builder) error
- func (s *Struct) QueryRow(ctx context.Context, db Executor, result interface{}, expr string, ...) error
- func (s *Struct) QueryRowB(ctx context.Context, db Executor, result interface{}, b sqlbuilder.Builder) error
- func (s *Struct) TagQuery(ctx context.Context, db Executor, result interface{}, tag, expr string, ...) error
- func (s *Struct) TagQueryB(ctx context.Context, db Executor, result interface{}, tag string, ...) error
- func (s *Struct) TagQueryRow(ctx context.Context, db Executor, result interface{}, tag, expr string, ...) error
- func (s *Struct) TagQueryRowB(ctx context.Context, db Executor, result interface{}, tag string, ...) error
- type TxCallback
- type UpdateCond
- type UpdateCondFunc
Constants ¶
View Source
const ( Insert = "Insert" InsertIgnore = "Insert Ignore" Replace = "Replace" )
objects insert ways
Variables ¶
View Source
var EmptyCond = CondFunc(func(Cond) {})
EmptyCond 空过滤条件
Functions ¶
func GetFloat64 ¶
GetFloat64 查询单个 float64
func GetTagStruct ¶
func GetTagStruct(ctx context.Context, db Executor, tag string, out interface{}, b sqlbuilder.Builder) error
GetTagStruct 查询单个结构体
func PullFloat64s ¶
PullFloat64s 查询单列 float64
func PullInt64s ¶
PullInt64s 查询单列 int64
func PullStrings ¶
PullStrings 查询单列字符串
func PullStructs ¶
PullStructs 查询结构体slice
func PullTagStructs ¶
func PullTagStructs(ctx context.Context, db Executor, tag string, out interface{}, b sqlbuilder.Builder) error
PullTagStructs 查询结构体slice
Types ¶
type Executor ¶
type Executor interface { QueryRowContext(ctx context.Context, query string, args ...interface{}) *sql.Row QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error) ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error) }
Executor is an *sql.DB or *sql.Tx or even *sql.Conn
type Struct ¶
type Struct struct { *sqlbuilder.Struct // contains filtered or unexported fields }
Struct 对 sqlbuilder.Struct 进行了封装,使其更易使用
func (*Struct) Exec ¶
func (s *Struct) Exec(ctx context.Context, db Executor, expr string, args ...interface{}) (sql.Result, error)
Exec ...
func (*Struct) Query ¶
func (s *Struct) Query(ctx context.Context, db Executor, result interface{}, expr string, args ...interface{}) error
Query ...
func (*Struct) QueryB ¶
func (s *Struct) QueryB(ctx context.Context, db Executor, result interface{}, b sqlbuilder.Builder) error
QueryB ...
func (*Struct) QueryRow ¶
func (s *Struct) QueryRow( ctx context.Context, db Executor, result interface{}, expr string, args ...interface{}, ) error
QueryRow ...
func (*Struct) QueryRowB ¶
func (s *Struct) QueryRowB(ctx context.Context, db Executor, result interface{}, b sqlbuilder.Builder) error
QueryRowB ...
func (*Struct) TagQuery ¶
func (s *Struct) TagQuery( ctx context.Context, db Executor, result interface{}, tag, expr string, args ...interface{}, ) error
TagQuery ...
func (*Struct) TagQueryB ¶
func (s *Struct) TagQueryB( ctx context.Context, db Executor, result interface{}, tag string, b sqlbuilder.Builder, ) error
TagQueryB ...
Click to show internal directories.
Click to hide internal directories.