Documentation ¶ Index ¶ func WithTx(ctx context.Context, db *sql.DB, fn func(tx *sql.Tx) error, ...) (err error) type Executor type Null func NewNull[T any](inp *T) Null[T] func (nt Null[T]) MarshalJSON() ([]byte, error) func (nt *Null[T]) UnmarshalJSON(data []byte) error type Preparation type Querier type Tx Constants ¶ This section is empty. Variables ¶ This section is empty. Functions ¶ func WithTx ¶ added in v0.4.37 func WithTx(ctx context.Context, db *sql.DB, fn func(tx *sql.Tx) error, opts ...*sql.TxOptions) (err error) Types ¶ type Executor ¶ type Executor interface { ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error) } type Null ¶ added in v0.4.23 type Null[T any] struct { sql.Null[T] } func NewNull ¶ added in v0.4.23 func NewNull[T any](inp *T) Null[T] func (Null[T]) MarshalJSON ¶ added in v0.4.23 func (nt Null[T]) MarshalJSON() ([]byte, error) func (*Null[T]) UnmarshalJSON ¶ added in v0.4.23 func (nt *Null[T]) UnmarshalJSON(data []byte) error type Preparation ¶ type Preparation interface { PrepareContext(ctx context.Context, query string) (*sql.Stmt, error) } type Querier ¶ type Querier interface { PingContext(ctx context.Context) error QueryContext(ctx context.Context, query string, args ...any) (*sql.Rows, error) QueryRowContext(ctx context.Context, query string, args ...any) *sql.Row BeginTx(ctx context.Context, opts *sql.TxOptions) (*sql.Tx, error) } type Tx ¶ type Tx interface { Querier Executor Commit() error Rollback() error } Source Files ¶ View all Source files contract.godata.gotx.go Click to show internal directories. Click to hide internal directories.