Versions in this module Expand all Collapse all v0 v0.0.3 Apr 22, 2020 v0.0.2 Apr 22, 2020 v0.0.1 Apr 21, 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") + var ErrTxDone = sql.ErrTxDone + type Config struct + Active int + Breaker *breaker.Config + DSN string + ExecTimeout time.Duration + Idle int + IdleTimeout time.Duration + QueryTimeout time.Duration + ReadDSN []string + TranTimeout time.Duration + type DB struct + func NewMySQL(c *Config) (db *DB) + func Open(c *Config) (*DB, error) + func (db *DB) Begin(c context.Context) (tx *Tx, err error) + func (db *DB) Close() (err error) + func (db *DB) Exec(c context.Context, query string, args ...interface{}) (res sql.Result, err error) + func (db *DB) Master() *DB + func (db *DB) Ping(c context.Context) (err error) + func (db *DB) Prepare(query string) (*Stmt, error) + func (db *DB) Prepared(query string) (stmt *Stmt) + func (db *DB) Query(c context.Context, query string, args ...interface{}) (rows *Rows, err error) + func (db *DB) QueryRow(c 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(c context.Context, args ...interface{}) (res sql.Result, err error) + func (s *Stmt) Query(c context.Context, args ...interface{}) (rows *Rows, err error) + func (s *Stmt) QueryRow(c 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