Versions in this module Expand all Collapse all v0 v0.0.3 Nov 18, 2020 v0.0.2 Nov 13, 2020 Changes in this version + var DefaultCacheSize = 200 + var ErrNoMapPointer = errors.New("mp should be a map's pointer") + var ErrNoStructPointer = errors.New("mp should be a struct's pointer") + func MapToSlice(query string, mp interface{}) (string, []interface{}, error) + func StructToSlice(query string, st interface{}) (string, []interface{}, error) + type DB struct + Logger log.ContextLogger + Mapper names.Mapper + func FromDB(db *sql.DB) *DB + func Open(driverName, dataSourceName string) (*DB, error) + func (db *DB) AddHook(h ...contexts.Hook) + func (db *DB) Begin() (*Tx, error) + func (db *DB) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) + func (db *DB) ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error) + func (db *DB) ExecMap(query string, mp interface{}) (sql.Result, error) + func (db *DB) ExecMapContext(ctx context.Context, query string, mp interface{}) (sql.Result, error) + func (db *DB) ExecStruct(query string, st interface{}) (sql.Result, error) + func (db *DB) ExecStructContext(ctx context.Context, query string, st interface{}) (sql.Result, error) + func (db *DB) NeedLogSQL(ctx context.Context) bool + func (db *DB) Prepare(query string) (*Stmt, error) + func (db *DB) PrepareContext(ctx context.Context, query string) (*Stmt, error) + func (db *DB) Query(query string, args ...interface{}) (*Rows, error) + func (db *DB) QueryContext(ctx context.Context, query string, args ...interface{}) (*Rows, error) + func (db *DB) QueryMap(query string, mp interface{}) (*Rows, error) + func (db *DB) QueryMapContext(ctx context.Context, query string, mp interface{}) (*Rows, error) + func (db *DB) QueryRow(query string, args ...interface{}) *Row + func (db *DB) QueryRowContext(ctx context.Context, query string, args ...interface{}) *Row + func (db *DB) QueryRowMap(query string, mp interface{}) *Row + func (db *DB) QueryRowMapContext(ctx context.Context, query string, mp interface{}) *Row + func (db *DB) QueryRowStruct(query string, st interface{}) *Row + func (db *DB) QueryRowStructContext(ctx context.Context, query string, st interface{}) *Row + func (db *DB) QueryStruct(query string, st interface{}) (*Rows, error) + func (db *DB) QueryStructContext(ctx context.Context, query string, st interface{}) (*Rows, error) + type EmptyScanner struct + func (EmptyScanner) Scan(src interface{}) error + type Executer interface + ExecContext func(ctx context.Context, query string, args ...interface{}) (sql.Result, error) + type NullTime time.Time + func (ns *NullTime) Scan(value interface{}) error + func (ns NullTime) Value() (driver.Value, error) + type QueryExecuter interface + type Queryer interface + QueryContext func(ctx context.Context, query string, args ...interface{}) (*Rows, error) + type Row struct + func ErrorRow(err error) *Row + func NewRow(rows *Rows, err error) *Row + func (row *Row) Columns() ([]string, error) + func (row *Row) Scan(dest ...interface{}) error + func (row *Row) ScanMap(dest interface{}) error + func (row *Row) ScanSlice(dest interface{}) error + func (row *Row) ScanStructByIndex(dest interface{}) error + func (row *Row) ScanStructByName(dest interface{}) error + func (row *Row) ToMapString() (map[string]string, error) + type Rows struct + func (rs *Rows) ScanMap(dest interface{}) error + func (rs *Rows) ScanSlice(dest interface{}) error + func (rs *Rows) ScanStructByIndex(dest ...interface{}) error + func (rs *Rows) ScanStructByName(dest interface{}) error + func (rs *Rows) ToMapString() ([]map[string]string, error) + type Stmt struct + func (s *Stmt) ExecContext(ctx context.Context, args ...interface{}) (sql.Result, error) + func (s *Stmt) ExecMap(mp interface{}) (sql.Result, error) + func (s *Stmt) ExecMapContext(ctx context.Context, mp interface{}) (sql.Result, error) + func (s *Stmt) ExecStruct(st interface{}) (sql.Result, error) + func (s *Stmt) ExecStructContext(ctx context.Context, st interface{}) (sql.Result, error) + func (s *Stmt) Query(args ...interface{}) (*Rows, error) + func (s *Stmt) QueryContext(ctx context.Context, args ...interface{}) (*Rows, error) + func (s *Stmt) QueryMap(mp interface{}) (*Rows, error) + func (s *Stmt) QueryMapContext(ctx context.Context, mp interface{}) (*Rows, error) + func (s *Stmt) QueryRow(args ...interface{}) *Row + func (s *Stmt) QueryRowContext(ctx context.Context, args ...interface{}) *Row + func (s *Stmt) QueryRowMap(mp interface{}) *Row + func (s *Stmt) QueryRowMapContext(ctx context.Context, mp interface{}) *Row + func (s *Stmt) QueryRowStruct(st interface{}) *Row + func (s *Stmt) QueryRowStructContext(ctx context.Context, st interface{}) *Row + func (s *Stmt) QueryStruct(st interface{}) (*Rows, error) + func (s *Stmt) QueryStructContext(ctx context.Context, st interface{}) (*Rows, error) + type Tx struct + func (tx *Tx) Commit() error + func (tx *Tx) ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error) + func (tx *Tx) ExecMap(query string, mp interface{}) (sql.Result, error) + func (tx *Tx) ExecMapContext(ctx context.Context, query string, mp interface{}) (sql.Result, error) + func (tx *Tx) ExecStruct(query string, st interface{}) (sql.Result, error) + func (tx *Tx) ExecStructContext(ctx context.Context, query string, st interface{}) (sql.Result, error) + func (tx *Tx) Prepare(query string) (*Stmt, error) + func (tx *Tx) PrepareContext(ctx context.Context, query string) (*Stmt, error) + func (tx *Tx) Query(query string, args ...interface{}) (*Rows, error) + func (tx *Tx) QueryContext(ctx context.Context, query string, args ...interface{}) (*Rows, error) + func (tx *Tx) QueryMap(query string, mp interface{}) (*Rows, error) + func (tx *Tx) QueryMapContext(ctx context.Context, query string, mp interface{}) (*Rows, error) + func (tx *Tx) QueryRow(query string, args ...interface{}) *Row + func (tx *Tx) QueryRowContext(ctx context.Context, query string, args ...interface{}) *Row + func (tx *Tx) QueryRowMap(query string, mp interface{}) *Row + func (tx *Tx) QueryRowMapContext(ctx context.Context, query string, mp interface{}) *Row + func (tx *Tx) QueryRowStruct(query string, st interface{}) *Row + func (tx *Tx) QueryRowStructContext(ctx context.Context, query string, st interface{}) *Row + func (tx *Tx) QueryStruct(query string, st interface{}) (*Rows, error) + func (tx *Tx) QueryStructContext(ctx context.Context, query string, st interface{}) (*Rows, error) + func (tx *Tx) Rollback() error + func (tx *Tx) Stmt(stmt *Stmt) *Stmt + func (tx *Tx) StmtContext(ctx context.Context, stmt *Stmt) *Stmt