zsql

package
v0.10.15 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2023 License: MIT Imports: 9 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 NullFloat64 added in v0.9.0

type NullFloat64 struct {
	sql.NullFloat64
}

func (NullFloat64) MarshalJSON added in v0.9.0

func (ni NullFloat64) MarshalJSON() ([]byte, error)

func (*NullFloat64) UnmarshalJSON added in v0.9.0

func (ni *NullFloat64) UnmarshalJSON(b []byte) error

type NullInt added in v0.10.14

type NullInt struct {
	sql.NullInt64
}

A JSON safe version of sql.NullInt

func (NullInt) MarshalJSON added in v0.10.14

func (ni NullInt) MarshalJSON() ([]byte, error)

func (*NullInt) UnmarshalJSON added in v0.10.14

func (ni *NullInt) UnmarshalJSON(b []byte) error

type NullInt16 added in v0.9.0

type NullInt16 struct {
	sql.NullInt16
}

func (NullInt16) MarshalJSON added in v0.9.0

func (ni NullInt16) MarshalJSON() ([]byte, error)

func (*NullInt16) UnmarshalJSON added in v0.9.0

func (ni *NullInt16) UnmarshalJSON(b []byte) error

type NullInt32 added in v0.9.0

type NullInt32 struct {
	sql.NullInt32
}

func (NullInt32) MarshalJSON added in v0.9.0

func (ni NullInt32) MarshalJSON() ([]byte, error)

func (*NullInt32) UnmarshalJSON added in v0.9.0

func (ni *NullInt32) UnmarshalJSON(b []byte) error

type NullInt64 added in v0.8.12

type NullInt64 struct {
	sql.NullInt64
}

A JSON safe version of sql.NullInt64

func (NullInt64) MarshalJSON added in v0.8.12

func (ni NullInt64) MarshalJSON() ([]byte, error)

func (*NullInt64) UnmarshalJSON added in v0.8.12

func (ni *NullInt64) UnmarshalJSON(b []byte) error

type NullString added in v0.10.12

type NullString struct {
	sql.NullString
}

func (NullString) MarshalJSON added in v0.10.12

func (ni NullString) MarshalJSON() ([]byte, error)

func (*NullString) UnmarshalJSON added in v0.10.12

func (ni *NullString) UnmarshalJSON(b []byte) error

type NullTime added in v0.9.0

type NullTime struct {
	sql.NullTime
}

func (NullTime) MarshalJSON added in v0.9.0

func (ni NullTime) MarshalJSON() ([]byte, error)

func (*NullTime) UnmarshalJSON added in v0.9.0

func (ni *NullTime) UnmarshalJSON(b []byte) 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