Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RollbackWithoutCancel ¶ added in v0.27.0
func RollbackWithoutCancel[TExec riverdriver.ExecutorTx](ctx context.Context, execTx TExec) error
RollbackWithoutCancel initiates a rollback, but one in which context is overridden with context.WithoutCancel so that the rollback can proceed even if a previous operation was cancelled. This decreases the chance that a transaction is accidentally left open and in an ambiguous state.
A rollback error is returned the same way most driver rollbacks return an error, but given this is normally expected to be used in a defer statement, it's unusual for the error to be handled.
func WithTx ¶
func WithTx[TExec riverdriver.Executor](ctx context.Context, exec TExec, innerFunc func(ctx context.Context, execTx riverdriver.ExecutorTx) error) error
WithTx starts and commits a transaction on a driver executor around the given function, allowing the return of a generic value.
Rollbacks use RollbackWithoutCancel to maximize the chance of a successful rollback even where an operation within the transaction timed out due to context timeout.
func WithTxV ¶
func WithTxV[TExec riverdriver.Executor, T any](ctx context.Context, exec TExec, innerFunc func(ctx context.Context, execTx riverdriver.ExecutorTx) (T, error)) (T, error)
WithTxV starts and commits a transaction on a driver executor around the given function, allowing the return of a generic value.
Rollbacks use RollbackWithoutCancel to maximize the chance of a successful rollback even where an operation within the transaction timed out due to context timeout.
Types ¶
This section is empty.