Versions in this module Expand all Collapse all v1 v1.0.1 Aug 17, 2026 Changes in this version + func BindArray(bindType int, query string, arg any, m *reflectx.Mapper) (string, []any, error) + func BindMap(bindType int, query string, args map[string]any) (string, []any, error) + func BindNamed(bindType int, query string, arg any) (string, []any, error) + func BindNamedMapper(bindType int, query string, arg any, m *reflectx.Mapper) (string, []any, error) + func BindStruct(bindType int, query string, arg any, m *reflectx.Mapper) (string, []any, error) + func CompileNamedQuery(qs []byte, bindType int) (query string, names []string, err error) + func FixBound(bound string, loop int) string + func GetContext(ctx context.Context, q QueryerContext, dest any, query string, args ...any) error + func IsUnsafe(i any) bool + func LoadFile(e core.Execer, path string) (*sql.Result, error) + func LoadFileContext(ctx context.Context, e ExecerContext, path string) (*sql.Result, error) + func MapperFor(i any) *reflectx.Mapper + func MustExecContext(ctx context.Context, e ExecerContext, query string, args ...any) sql.Result + func Named(query string, arg any) (string, []any, error) + func NamedExec(e core.Ext, query string, arg any) (sql.Result, error) + func NamedExecContext(ctx context.Context, e ExtContext, query string, arg any) (sql.Result, error) + func NamedQuery(e core.Ext, query string, arg any) (*core.Rows, error) + func NamedQueryContext(ctx context.Context, e ExtContext, query string, arg any) (*core.Rows, error) + func SelectContext(ctx context.Context, q QueryerContext, dest any, query string, args ...any) error + func WithSetUnsafe(u bool) func(*dbOptions) + func WithUnsafe() func(*dbOptions) + type Conn struct + Mapper *reflectx.Mapper + func (c *Conn) BeginTxx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) + func (c *Conn) ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error) + func (c *Conn) GetContext(ctx context.Context, dest any, query string, args ...any) error + func (c *Conn) PreparexContext(ctx context.Context, query string) (*Stmt, error) + func (c *Conn) QueryContext(ctx context.Context, query string, args ...any) (*sql.Rows, error) + func (c *Conn) QueryRowContext(ctx context.Context, query string, args ...any) *sql.Row + func (c *Conn) QueryRowxContext(ctx context.Context, query string, args ...any) *core.Row + func (c *Conn) QueryxContext(ctx context.Context, query string, args ...any) (*core.Rows, error) + func (c *Conn) Rebind(query string) string + func (c *Conn) SelectContext(ctx context.Context, dest any, query string, args ...any) error + type DB struct + Mapper *reflectx.Mapper + func Connect(driverName, dataSourceName string, args ...func(*dbOptions)) (*DB, error) + func ConnectContext(ctx context.Context, driverName, dataSourceName string, ...) (*DB, error) + func MustConnect(driverName, dataSourceName string, args ...func(*dbOptions)) *DB + func MustOpen(driverName, dataSourceName string, args ...func(*dbOptions)) *DB + func NewDb(d *sql.DB, driverName string, args ...func(*dbOptions)) *DB + func Open(driverName, dataSourceName string, args ...func(*dbOptions)) (*DB, error) + func (db *DB) BeginTxx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) + func (db *DB) Beginx() (*Tx, error) + func (db *DB) BindNamed(query string, arg any) (string, []any, error) + func (db *DB) Connx(ctx context.Context) (*Conn, error) + func (db *DB) DriverName() string + func (db *DB) Exec(query string, args ...any) (sql.Result, error) + func (db *DB) ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error) + func (db *DB) Get(dest any, query string, args ...any) error + func (db *DB) GetContext(ctx context.Context, dest any, query string, args ...any) error + func (db *DB) MapperFunc(mf func(string) string) + func (db *DB) MustBegin() *Tx + func (db *DB) MustBeginTx(ctx context.Context, opts *sql.TxOptions) *Tx + func (db *DB) MustExec(query string, args ...any) sql.Result + func (db *DB) MustExecContext(ctx context.Context, query string, args ...any) sql.Result + func (db *DB) NamedExec(query string, arg any) (sql.Result, error) + func (db *DB) NamedExecContext(ctx context.Context, query string, arg any) (sql.Result, error) + func (db *DB) NamedQuery(query string, arg any) (*core.Rows, error) + func (db *DB) NamedQueryContext(ctx context.Context, query string, arg any) (*core.Rows, error) + func (db *DB) PrepareNamed(query string) (*NamedStmt, error) + func (db *DB) PrepareNamedContext(ctx context.Context, query string) (*NamedStmt, error) + func (db *DB) Preparex(query string) (*Stmt, error) + func (db *DB) PreparexContext(ctx context.Context, query string) (*Stmt, error) + func (db *DB) Query(query string, args ...any) (*sql.Rows, error) + func (db *DB) QueryContext(ctx context.Context, query string, args ...any) (*sql.Rows, error) + func (db *DB) QueryRow(query string, args ...any) *sql.Row + func (db *DB) QueryRowContext(ctx context.Context, query string, args ...any) *sql.Row + func (db *DB) QueryRowx(query string, args ...any) *core.Row + func (db *DB) QueryRowxContext(ctx context.Context, query string, args ...any) *core.Row + func (db *DB) Queryx(query string, args ...any) (*core.Rows, error) + func (db *DB) QueryxContext(ctx context.Context, query string, args ...any) (*core.Rows, error) + func (db *DB) Rebind(query string) string + func (db *DB) Select(dest any, query string, args ...any) error + func (db *DB) SelectContext(ctx context.Context, dest any, query string, args ...any) error + func (db *DB) SetUnsafe(u bool) + func (db *DB) Unsafe() *DB + type ExecerContext interface + ExecContext func(ctx context.Context, query string, args ...any) (sql.Result, error) + type ExtContext interface + type NamedStmt struct + Params []string + QueryString string + Stmt *Stmt + func (n *NamedStmt) Close() error + func (n *NamedStmt) Exec(arg any) (sql.Result, error) + func (n *NamedStmt) ExecContext(ctx context.Context, arg any) (sql.Result, error) + func (n *NamedStmt) Get(dest any, arg any) error + func (n *NamedStmt) GetContext(ctx context.Context, dest any, arg any) error + func (n *NamedStmt) MustExec(arg any) sql.Result + func (n *NamedStmt) MustExecContext(ctx context.Context, arg any) sql.Result + func (n *NamedStmt) Query(arg any) (*sql.Rows, error) + func (n *NamedStmt) QueryContext(ctx context.Context, arg any) (*sql.Rows, error) + func (n *NamedStmt) QueryRow(arg any) *core.Row + func (n *NamedStmt) QueryRowContext(ctx context.Context, arg any) *core.Row + func (n *NamedStmt) QueryRowx(arg any) *core.Row + func (n *NamedStmt) QueryRowxContext(ctx context.Context, arg any) *core.Row + func (n *NamedStmt) Queryx(arg any) (*core.Rows, error) + func (n *NamedStmt) QueryxContext(ctx context.Context, arg any) (*core.Rows, error) + func (n *NamedStmt) Select(dest any, arg any) error + func (n *NamedStmt) SelectContext(ctx context.Context, dest any, arg any) error + func (n *NamedStmt) Unsafe() *NamedStmt + type PreparerContext interface + PrepareContext func(ctx context.Context, query string) (*sql.Stmt, error) + type QStmt struct + func (q *QStmt) Exec(query string, args ...any) (sql.Result, error) + func (q *QStmt) ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error) + func (q *QStmt) Query(query string, args ...any) (*sql.Rows, error) + func (q *QStmt) QueryContext(ctx context.Context, query string, args ...any) (*sql.Rows, error) + func (q *QStmt) QueryRowx(query string, args ...any) *core.Row + func (q *QStmt) QueryRowxContext(ctx context.Context, query string, args ...any) *core.Row + func (q *QStmt) Queryx(query string, args ...any) (*core.Rows, error) + func (q *QStmt) QueryxContext(ctx context.Context, query string, args ...any) (*core.Rows, error) + type Queryable interface + Get func(any, string, ...any) error + GetContext func(context.Context, any, string, ...any) error + MustExec func(string, ...any) sql.Result + MustExecContext func(context.Context, string, ...any) sql.Result + NamedExec func(string, any) (sql.Result, error) + NamedExecContext func(context.Context, string, any) (sql.Result, error) + NamedQuery func(string, any) (*core.Rows, error) + NamedQueryContext func(context.Context, string, any) (*core.Rows, error) + PrepareNamed func(string) (*NamedStmt, error) + PrepareNamedContext func(context.Context, string) (*NamedStmt, error) + Preparex func(string) (*Stmt, error) + PreparexContext func(context.Context, string) (*Stmt, error) + QueryRow func(string, ...any) *sql.Row + QueryRowContext func(context.Context, string, ...any) *sql.Row + Select func(any, string, ...any) error + SelectContext func(context.Context, any, string, ...any) error + type QueryerContext interface + QueryContext func(ctx context.Context, query string, args ...any) (*sql.Rows, error) + QueryRowxContext func(ctx context.Context, query string, args ...any) *core.Row + QueryxContext func(ctx context.Context, query string, args ...any) (*core.Rows, error) + type Stmt struct + Mapper *reflectx.Mapper + func Preparex(p core.Preparer, query string) (*Stmt, error) + func PreparexContext(ctx context.Context, p PreparerContext, query string) (*Stmt, error) + func (s *Stmt) Get(dest any, args ...any) error + func (s *Stmt) GetContext(ctx context.Context, dest any, args ...any) error + func (s *Stmt) MustExec(args ...any) sql.Result + func (s *Stmt) MustExecContext(ctx context.Context, args ...any) sql.Result + func (s *Stmt) QueryRowx(args ...any) *core.Row + func (s *Stmt) QueryRowxContext(ctx context.Context, args ...any) *core.Row + func (s *Stmt) Queryx(args ...any) (*core.Rows, error) + func (s *Stmt) QueryxContext(ctx context.Context, args ...any) (*core.Rows, error) + func (s *Stmt) Select(dest any, args ...any) error + func (s *Stmt) SelectContext(ctx context.Context, dest any, args ...any) error + func (s *Stmt) Unsafe() *Stmt + type Tx struct + Mapper *reflectx.Mapper + func (tx *Tx) BindNamed(query string, arg any) (string, []any, error) + func (tx *Tx) DriverName() string + func (tx *Tx) Exec(query string, args ...any) (sql.Result, error) + func (tx *Tx) ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error) + func (tx *Tx) Get(dest any, query string, args ...any) error + func (tx *Tx) GetContext(ctx context.Context, dest any, query string, args ...any) error + func (tx *Tx) MustExec(query string, args ...any) sql.Result + func (tx *Tx) MustExecContext(ctx context.Context, query string, args ...any) sql.Result + func (tx *Tx) NamedExec(query string, arg any) (sql.Result, error) + func (tx *Tx) NamedExecContext(ctx context.Context, query string, arg any) (sql.Result, error) + func (tx *Tx) NamedQuery(query string, arg any) (*core.Rows, error) + func (tx *Tx) NamedQueryContext(ctx context.Context, query string, arg any) (*core.Rows, error) + func (tx *Tx) NamedStmt(stmt *NamedStmt) *NamedStmt + func (tx *Tx) NamedStmtContext(ctx context.Context, stmt *NamedStmt) *NamedStmt + func (tx *Tx) PrepareNamed(query string) (*NamedStmt, error) + func (tx *Tx) PrepareNamedContext(ctx context.Context, query string) (*NamedStmt, error) + func (tx *Tx) Preparex(query string) (*Stmt, error) + func (tx *Tx) PreparexContext(ctx context.Context, query string) (*Stmt, error) + func (tx *Tx) Query(query string, args ...any) (*sql.Rows, error) + func (tx *Tx) QueryContext(ctx context.Context, query string, args ...any) (*sql.Rows, error) + func (tx *Tx) QueryRow(query string, args ...any) *sql.Row + func (tx *Tx) QueryRowContext(ctx context.Context, query string, args ...any) *sql.Row + func (tx *Tx) QueryRowx(query string, args ...any) *core.Row + func (tx *Tx) QueryRowxContext(ctx context.Context, query string, args ...any) *core.Row + func (tx *Tx) Queryx(query string, args ...any) (*core.Rows, error) + func (tx *Tx) QueryxContext(ctx context.Context, query string, args ...any) (*core.Rows, error) + func (tx *Tx) Rebind(query string) string + func (tx *Tx) Select(dest any, query string, args ...any) error + func (tx *Tx) SelectContext(ctx context.Context, dest any, query string, args ...any) error + func (tx *Tx) Stmtx(stmt any) *Stmt + func (tx *Tx) StmtxContext(ctx context.Context, stmt any) *Stmt + func (tx *Tx) Unsafe() *Tx