Documentation ¶
Index ¶
- func Exec(ctx context.Context, e Execer, query string, args ...interface{}) (sql.Result, error)
- func Get(ctx context.Context, q Queryer, dest interface{}, query string, ...) error
- func MustExec(ctx context.Context, e Execer, query string, args ...interface{}) sql.Result
- func NamedExec(ctx context.Context, e Ext, query string, arg interface{}) (sql.Result, error)
- func NamedQuery(ctx context.Context, e Ext, query string, arg interface{}) (*sqlx.Rows, error)
- func Query(ctx context.Context, q Queryer, query string, args ...interface{}) (*sql.Rows, error)
- func QueryRowx(ctx context.Context, q Queryer, query string, args ...interface{}) *sqlx.Row
- func Queryx(ctx context.Context, q Queryer, query string, args ...interface{}) (*sqlx.Rows, error)
- func Select(ctx context.Context, q Queryer, dest interface{}, query string, ...) error
- func Transact(db DB, fn func(tx *sql.Tx) error) (err error)
- func TransactContext(ctx context.Context, opts *sql.TxOptions, db DB, ...) (err error)
- func TransactContextx(ctx context.Context, opts *sql.TxOptions, db DBx, ...) (err error)
- func Transactx(db DBx, fn func(tx *sqlx.Tx) error) (err error)
- type DB
- type DBx
- type Execer
- type Ext
- type Queryer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NamedQuery ¶
NamedQuery equals to sqlx.NamedQuery and sqlx.NamedQueryContext.
func QueryRowx ¶
QueryRowx equals to sqlx.Queryer.QueryRowx and sqlx.QueryerContext.QueryRowxContext.
func Select ¶
func Select(ctx context.Context, q Queryer, dest interface{}, query string, args ...interface{}) error
Select equals to sqlx.Select and sqlx.SelectContext.
func Transact ¶
Transact begins a transaction, and then invokes fn. Rollback automatically if receives a panic or error.
func TransactContext ¶
func TransactContext(ctx context.Context, opts *sql.TxOptions, db DB, fn func(ctx context.Context, tx *sql.Tx) error) (err error)
TransactContext begins a transaction, and then invokes fn. Rollback automatically if receives a panic or error.
Types ¶
type DB ¶
type DB interface { Begin() (*sql.Tx, error) BeginTx(ctx context.Context, opts *sql.TxOptions) (*sql.Tx, error) }
DB is an interface for sql.DB and sqlx.DB.
type DBx ¶
type DBx interface { DB Beginx() (*sqlx.Tx, error) BeginTxx(ctx context.Context, opts *sql.TxOptions) (*sqlx.Tx, error) }
DBx is an interface for sqlx.DB.
type Execer ¶
type Execer interface { sqlx.Execer sqlx.ExecerContext }
Execer is an interface that wraps sqlx.Execer and sqlx.ExecerContext.
Click to show internal directories.
Click to hide internal directories.