Documentation ¶
Index ¶
- Variables
- func Bulk(ctx context.Context, feeder func(*sql.Stmt) error, schema, table string, ...) error
- func Create(ctx context.Context, query string, args ...interface{}) (uint64, error)
- func DoAtomic(ctx context.Context, db *sql.DB, action func(context.Context) error) error
- func Exec(ctx context.Context, query string, args ...interface{}) error
- func Get(ctx context.Context, db *sql.DB, scanner func(*sql.Row) error, query string, ...) error
- func List(ctx context.Context, db *sql.DB, scanner func(*sql.Rows) error, query string, ...) error
- func New(config Config) (*sql.DB, error)
- func Ping(db *sql.DB) bool
- func StoreTx(ctx context.Context, tx *sql.Tx) context.Context
- type Config
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrNoHost occurs when host is not provided in configuration ErrNoHost = errors.New("no host for database connection") // ErrNoTransaction occurs when no transaction is provided but needed ErrNoTransaction = errors.New("no transaction in context, please wrap with DoAtomic()") // ErrBulkEnded occurs when bulk creation is over ErrBulkEnded = errors.New("no more data to copy") // SQLTimeout when running queries SQLTimeout = time.Second * 5 )
Functions ¶
func Bulk ¶ added in v3.22.0
func Bulk(ctx context.Context, feeder func(*sql.Stmt) error, schema, table string, columns ...string) error
Bulk load data into schema and table by batch
func Get ¶ added in v3.20.0
func Get(ctx context.Context, db *sql.DB, scanner func(*sql.Row) error, query string, args ...interface{}) error
Get execute single row query
Types ¶
Click to show internal directories.
Click to hide internal directories.