dbutils

package
v0.0.0-...-b0885cc Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Exec

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

func Get

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

func GetMap

func GetMap(ctx context.Context, db sqlx.QueryerContext, query string, args ...interface{}) (ret map[string]interface{}, err error)

func NamedExec

func NamedExec(ctx context.Context, db sqlx.ExtContext, query string, arg interface{}) (sql.Result, error)

func NamedGet

func NamedGet(ctx context.Context, db sqlx.ExtContext, dest interface{}, query string, arg interface{}) error

func NamedGetMap

func NamedGetMap(ctx context.Context, db sqlx.ExtContext, query string, arg interface{}) (ret map[string]interface{}, err error)

func NamedSelect

func NamedSelect(ctx context.Context, db sqlx.ExtContext, dest interface{}, query string, arg interface{}) error

func NamedSelectMaps

func NamedSelectMaps(ctx context.Context, db sqlx.ExtContext, query string, arg interface{}) (ret []map[string]interface{}, err error)

func RunTx

func RunTx(ctx context.Context, db TxRunner, f TxFunc) (err error)

func Select

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

func SelectMaps

func SelectMaps(ctx context.Context, db sqlx.QueryerContext, query string, args ...interface{}) (ret []map[string]interface{}, err error)

Types

type TxFunc

type TxFunc func(tx *sqlx.Tx) error

type TxRunner

type TxRunner interface {
	BeginTxx(context.Context, *sql.TxOptions) (*sqlx.Tx, error)
}

Jump to

Keyboard shortcuts

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