Versions in this module Expand all Collapse all v0 v0.1.122 Oct 2, 2022 v0.1.121 Oct 2, 2022 v0.1.14 Oct 2, 2022 Changes in this version + const AT + const DOLLAR + const NAMED + const QUESTION + const UNKNOWN + var DeletedNo int64 = 0 + var DeletedYes int64 = 1 + var ErrNoMaster = errors.New("sql: no master instance") + var ErrNotFound = sql.ErrNoRows + var NameMapper = strings.ToLower + func BindDriver(driverName string, bindType int) + func BindNamed(bindType int, query string, arg interface{}) (string, []interface{}, error) + func BindType(driverName string) int + func CheckExists(ctx context.Context, db *DB, table string, params map[string]interface{}) (bool, error) + func In(query string, args ...interface{}) (string, []interface{}, error) + func IsDuplicate(err error) bool + func IsMissingDb(err error) bool + func Must(sc StoreChannel) interface + func Named(query string, arg interface{}) (string, []interface{}, error) + func Rebind(bindType int, query string) string + type CommonDAO struct + func NewCommonDAO(db *DB) *CommonDAO + func (dao *CommonDAO) CalcSize(ctx context.Context, table string, params map[string]interface{}) int + func (dao *CommonDAO) CalcSizeByWhere(ctx context.Context, table, where string) int + func (dao *CommonDAO) CheckExists(ctx context.Context, table string, params map[string]interface{}) bool + func (dao *CommonDAO) DB() *DB + type Config struct + Active int + DSN string + Idle int + IdleTimeout string + ReadDSN []string + type DB struct + func NewMySQL(c *Config) (db *DB) + func Open(c *Config) (*DB, 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) NamedExec(c context.Context, query string, arg interface{}) (res sql.Result, err error) + func (db *DB) NamedQueryRow(c context.Context, v interface{}, query string, arg interface{}) error + func (db *DB) NamedQueryRowPartial(ctx context.Context, v interface{}, query string, arg interface{}) error + func (db *DB) NamedQueryRows(c context.Context, v interface{}, query string, arg interface{}) error + func (db *DB) NamedQueryRowsPartial(c context.Context, v interface{}, query string, arg interface{}) (err error) + func (db *DB) Prepare(c context.Context, query string) (sqlx.StmtSession, error) + func (db *DB) QueryRow(c context.Context, v interface{}, query string, args ...interface{}) (err error) + func (db *DB) QueryRowPartial(c context.Context, v interface{}, query string, args ...interface{}) error + func (db *DB) QueryRows(c context.Context, v interface{}, query string, args ...interface{}) (err error) + func (db *DB) QueryRowsPartial(c context.Context, v interface{}, query string, args ...interface{}) (err error) + func (db *DB) Transact(ctx context.Context, fn func(*Tx) error) error + type ExecResult struct + LastInsertId int64 + RowsAffected int64 + type StoreChannel chan StoreResult + func Do(f func(result *StoreResult)) StoreChannel + type StoreResult struct + Cost int + Data interface{} + Err error + func TxWrapper(ctx context.Context, db *DB, txF func(*Tx, *StoreResult)) *StoreResult + type Tx struct + func (tx *Tx) Context() context.Context + func (tx *Tx) Exec(query string, args ...interface{}) (sql.Result, error) + func (tx *Tx) NamedExec(query string, arg interface{}) (sql.Result, error) + func (tx *Tx) NamedQueryRow(v interface{}, query string, arg interface{}) error + func (tx *Tx) NamedQueryRowPartial(v interface{}, query string, arg interface{}) error + func (tx *Tx) NamedQueryRows(v interface{}, query string, arg interface{}) error + func (tx *Tx) NamedQueryRowsPartial(v interface{}, query string, arg interface{}) error + func (tx *Tx) Prepare(query string) (sqlx.StmtSession, error) + func (tx *Tx) QueryRow(v interface{}, query string, args ...interface{}) error + func (tx *Tx) QueryRowPartial(v interface{}, query string, args ...interface{}) error + func (tx *Tx) QueryRows(v interface{}, query string, args ...interface{}) error + func (tx *Tx) QueryRowsPartial(v interface{}, query string, args ...interface{}) error