Documentation
¶
Index ¶
- func Batch[S Storer, F Finder[R], R any](db S, finder F, batchNum int, handler func([]R) error) (err error)
- func BatchConcurrent[S Storer, F Finder[R], R any](db S, finder F, batchNum int, handler func([]R) error, concNum int) (err error)
- func FindAll[S Storer, F Finder[R], R any](db S, finder F, inital R) (r []R, err error)
- func FindFirst[S Storer, F Finder[R], R any](db S, finder F, res *R) (err error)
- func FindList[S Storer, F Finder[R], R any](db S, finder F, res *[]R) (err error)
- func FindOne[S Storer, F Finder[R], R any](db S, finder F, inital R) (r R, err error)
- func PrintFields(fields []any)
- func WrapConnFindAll[F Finder[R], R any](ctx context.Context, db *sql.DB, finder F, inital R) (r []R, err error)
- func WrapDB(ctx context.Context, driverName string, dataSourceName string, ...) error
- func WrapSQLConn(ctx context.Context, db *sql.DB, ...) error
- func WrapSQLQueryRows(ctx context.Context, db *sql.DB, stmt string, args []interface{}, ...) error
- func WrapTx(ctx context.Context, db *sql.DB, f func(ctx context.Context, tx *sql.Tx) error) (err error)
- func WrapTxFindAll[F Finder[R], R any](ctx context.Context, db *sql.DB, finder F, inital R) (r []R, err error)
- type Finder
- type Storer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Batch ¶ added in v0.26.0
func Batch[S Storer, F Finder[R], R any](db S, finder F, batchNum int, handler func([]R) error) (err error)
Batch 批量处理查询到的数据
func BatchConcurrent ¶ added in v0.26.0
func BatchConcurrent[S Storer, F Finder[R], R any](db S, finder F, batchNum int, handler func([]R) error, concNum int) (err error)
BatchConcurrent 并发批量处理查询到的数据
func PrintFields ¶ added in v0.25.0
func PrintFields(fields []any)
func WrapConnFindAll ¶ added in v0.26.0
func WrapConnFindAll[F Finder[R], R any]( ctx context.Context, db *sql.DB, finder F, inital R, ) (r []R, err error)
WrapConnFindAll query by stmt and args, return values with dest support many rows
func WrapSQLConn ¶
func WrapSQLQueryRows ¶
func WrapSQLQueryRows( ctx context.Context, db *sql.DB, stmt string, args []interface{}, dest ...interface{}, ) error
WrapSQLQueryRows query by stmt and args, return values with dest only support one row
Types ¶
Click to show internal directories.
Click to hide internal directories.