db

package
v2.8.18 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 17, 2022 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Begin

func Begin(ctx context.Context, ops *sql.TxOptions) (*sqlx.Tx, error)

Begin begins a transaction and returns an *sqlx.Tx instead of an *sql.Tx.

func Exec

func Exec(ctx context.Context, query string, args ...interface{}) (sql.Result, error)

Exec executes a query without returning any rows. The args are for any placeholder parameters in the query.

func Get

func Get(ctx context.Context, dest interface{}, query string, args ...interface{}) error

Get using this db. Any placeholder parameters are replaced with supplied args. An error is returned if the result set is empty.

func MustBegin

func MustBegin(ctx context.Context, ops *sql.TxOptions) *sqlx.Tx

MustBegin starts a transaction, and panics on error. Returns an *sqlx.Tx instead of an *sql.Tx.

func Prepare

func Prepare(ctx context.Context, query string) (*sqlx.Stmt, error)

Prepare returns an sqlx.Stmt instead of a sql.Stmt

func PrepareNamed

func PrepareNamed(ctx context.Context, query string) (*sqlx.NamedStmt, error)

PrepareNamed returns an sqlx.NamedStmt

func RNamedQuery

func RNamedQuery(ctx context.Context, query string, arg interface{}) (*sqlx.Rows, error)

RNamedQuery using this db. Any named placeholder parameters are replaced with fields from arg.

func RQuery

func RQuery(ctx context.Context, query string, args ...interface{}) (*sqlx.Rows, error)

RQuery queries the database and returns an *sqlx.Row. Any placeholder parameters are replaced with supplied args.

func RQueryRow

func RQueryRow(ctx context.Context, query string, args ...interface{}) *sqlx.Row

RQueryRow queries the database and returns an *sqlx.Row. Any placeholder parameters are replaced with supplied args.

func Select

func Select(ctx context.Context, dest interface{}, query string, args ...interface{}) error

Select using this db. Any placeholder parameters are replaced with supplied args.

func WNamedExec

func WNamedExec(ctx context.Context, query string, arg interface{}) (sql.Result, error)

WNamedExec using this db. Any named placeholder parameters are replaced with fields from arg.

func WNamedQuery

func WNamedQuery(ctx context.Context, query string, arg interface{}) (*sqlx.Rows, error)

WNamedQuery using this db. Any named placeholder parameters are replaced with fields from arg.

func WQuery

func WQuery(ctx context.Context, query string, args ...interface{}) (*sqlx.Rows, error)

WQuery queries the database and returns an *sqlx.Row. Any placeholder parameters are replaced with supplied args.

func WQueryRow

func WQueryRow(ctx context.Context, query string, args ...interface{}) *sqlx.Row

WQueryRow queries the database and returns an *sqlx.Row. Any placeholder parameters are replaced with supplied args.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL