zsql

package
v0.7.7 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2022 License: MIT Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParamsFor added in v0.7.4

func ParamsFor(vals ...string) string

Return a string of params the same length as the parameters

func WithBegin added in v0.6.0

func WithBegin(db DB, handler TxHandler) (err error)

Execute db.Begin with a closure

func WithBeginNOP added in v0.6.0

func WithBeginNOP(db DB, handler TxHandler) (err error)

WithBegin without actuallly starting a transaction

func WithBeginTx added in v0.6.0

func WithBeginTx(db DB, handler TxHandler, ctx context.Context, opts *sql.TxOptions) (err error)

Call db.BeginTx with a closure

func WithBeginTxx added in v0.6.0

func WithBeginTxx(db DBx, handler TxxHandler, ctx context.Context, opts *sql.TxOptions) (err error)

Call db.BeginTxx with a closure

func WithBeginx added in v0.6.0

func WithBeginx(db DBx, handler TxxHandler) (err error)

Call db.Begin with a closure

func WithBeginxNOP added in v0.6.0

func WithBeginxNOP(db DBx, handler TxxHandler) (err error)

WithBeginx without actuallly starting a transaction

Types

type DB

type DB interface {
	Driver() driver.Driver
	Begin() (*sql.Tx, error)
	BeginTx(ctx context.Context, opts *sql.TxOptions) (*sql.Tx, error)
	// contains filtered or unexported methods
}

type DBx added in v0.5.3

type DBx interface {
	DB
	Beginx() (*sqlx.Tx, error)
	BeginTxx(ctx context.Context, opts *sql.TxOptions) (*sqlx.Tx, error)
}

type Tx added in v0.6.0

type Tx interface {
	Stmt(stmt *sql.Stmt) (s *sql.Stmt)
	StmtContext(ctx context.Context, stmt *sql.Stmt) (s *sql.Stmt)
	// contains filtered or unexported methods
}

type TxHandler

type TxHandler = func(tx Tx) error

type Txx added in v0.6.0

type Txx interface {
	Tx
	MustExec(query string, arguments ...interface{}) (r sql.Result)
	MustExecContext(ctx context.Context, query string, arguments ...interface{}) (r sql.Result)
	NamedExec(query string, arguments interface{}) (r sql.Result, err error)
	NamedExecContext(ctx context.Context, query string, arguments interface{}) (r sql.Result, err error)
	NamedStmt(stmt *sqlx.NamedStmt) (ns *sqlx.NamedStmt)
	NamedStmtContext(ctx context.Context, stmt *sqlx.NamedStmt) (ns *sqlx.NamedStmt)
	NamedQuery(query string, arguments interface{}) (rows *sqlx.Rows, err error)
}

type TxxHandler added in v0.5.3

type TxxHandler = func(tx Txx) error

Jump to

Keyboard shortcuts

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