Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Transact ¶
func Transact[D any](ctx context.Context, newD func(Queryer) D, q Queryer, opts *TxOptions, fn func(D) error) (err error)
Transact is a helper for executing transactions with a domain specific type. A typical use looks like:
func (d *MyD) Transaction(ctx context.Context, fn func(*MyD) error) (err error) { return sqlutil.Transact(ctx, d.new, d.q, nil, fn) }
Types ¶
type JSON ¶
type JSON json.RawMessage
JSON defined JSON data type, need to implements driver.Valuer, sql.Scanner interface
func (JSON) MarshalJSON ¶
MarshalJSON to output non base64 encoded []byte
func (*JSON) UnmarshalJSON ¶
UnmarshalJSON to deserialize []byte
type Queryer ¶
type Queryer interface { sqlx.ExtContext sqlx.PreparerContext GetContext(ctx context.Context, dest interface{}, query string, args ...interface{}) error SelectContext(ctx context.Context, dest interface{}, query string, args ...interface{}) error }
Queryer is implemented by *sqlx.DB, *sqlx.Tx, & *sqlx.Conn.
Click to show internal directories.
Click to hide internal directories.