Versions in this module Expand all Collapse all v1 v1.0.0 Dec 1, 2020 v0 v0.2.0 Oct 31, 2020 v0.1.0 Oct 9, 2020 Changes in this version + var ErrNoMaster = errors.New("sql: no master instance") + var ErrNoRows = sql.ErrNoRows + var ErrStmtNil = errors.New("sql: prepare failed and stmt nil") + type Config struct + Active int + DBName string + DSN string + ExecTimeout time.Duration + Idle int + IdleTimeout time.Duration + QueryTimeout time.Duration + ReadDSN []string + SlowQueryDuration time.Duration + TranTimeout time.Duration + type DB struct + func New(c *Config) (db *DB) + func Open(c *Config) (*DB, error) + func (db *DB) Begin(ctx context.Context) (tx *Tx, err error) + func (db *DB) Close() (err error) + func (db *DB) Exec(ctx context.Context, query string, args ...interface{}) (res sql.Result, err error) + func (db *DB) Master() *DB + func (db *DB) Ping(ctx context.Context) (err error) + func (db *DB) Prepare(ctx context.Context, query string) (*Stmt, error) + func (db *DB) Prepared(ctx context.Context, query string) (stmt *Stmt) + func (db *DB) Query(ctx context.Context, query string, args ...interface{}) (rows *Rows, err error) + func (db *DB) QueryRow(ctx context.Context, query string, args ...interface{}) *Row + type Row struct + func (r *Row) Scan(dest ...interface{}) (err error) + type Rows struct + func (rs *Rows) Close() (err error) + type Stmt struct + func (s *Stmt) Close() (err error) + func (s *Stmt) Exec(ctx context.Context, args ...interface{}) (res sql.Result, err error) + func (s *Stmt) Query(ctx context.Context, args ...interface{}) (rows *Rows, err error) + func (s *Stmt) QueryRow(ctx context.Context, args ...interface{}) (row *Row) + type Tx struct + func (tx *Tx) Commit() (err error) + func (tx *Tx) Exec(query string, args ...interface{}) (res sql.Result, err error) + func (tx *Tx) Prepare(query string) (*Stmt, error) + func (tx *Tx) Query(query string, args ...interface{}) (rows *Rows, err error) + func (tx *Tx) QueryRow(query string, args ...interface{}) *Row + func (tx *Tx) Rollback() (err error) + func (tx *Tx) Stmt(stmt *Stmt) *Stmt