Documentation ¶
Index ¶
- func WithExecutorTx(ctx context.Context, exec riverdriver.Executor, ...) error
- func WithExecutorTxV[T any](ctx context.Context, exec riverdriver.Executor, ...) (T, error)
- func WithTx(ctx context.Context, txBeginner TxBeginner, ...) error
- func WithTxV[T any](ctx context.Context, txBeginner TxBeginner, ...) (T, error)
- type Executor
- type TxBeginner
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithExecutorTx ¶ added in v0.0.13
func WithExecutorTx(ctx context.Context, exec riverdriver.Executor, innerFunc func(ctx context.Context, tx riverdriver.ExecutorTx) error) error
WithExecutorTx starts and commits a transaction on a driver executor around the given function, allowing the return of a generic value.
func WithExecutorTxV ¶ added in v0.0.13
func WithExecutorTxV[T any](ctx context.Context, exec riverdriver.Executor, innerFunc func(ctx context.Context, tx riverdriver.ExecutorTx) (T, error)) (T, error)
WithExecutorTxV starts and commits a transaction on a driver executor around the given function, allowing the return of a generic value.
Types ¶
type Executor ¶
type Executor interface { TxBeginner dbsqlc.DBTX }
Executor is an interface for a type that can begin a transaction and also perform all the operations needed to be used in conjunction with sqlc. Implemented by all of pgx's `pgxpool.Pool`, `pgx.Conn`, and `pgx.Tx` (transactions can start subtransactions).
type TxBeginner ¶
TxBeginner is an interface to a type that can begin a transaction, like a pgx connection pool, connection, or transaction (the latter would begin a subtransaction).