Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithTx ¶
func WithTx(ctx context.Context, db *sql.DB, fn func(ctx context.Context, tx *sql.Tx) error) (err error)
WithTx executes the given function within a database transaction.
This function is reentrant. It will create nested transactions using SAVEPOINTs if needed. However, transactions are not thread-safe, so care must be used when creating goroutines inside transactions: ensure a separate context is used that does not carry the transaction with it.
Types ¶
type PanicError ¶ added in v0.1.2
type PanicError struct {
Cause error
}
func (*PanicError) Error ¶ added in v0.1.2
func (e *PanicError) Error() string
type RollbackError ¶ added in v0.1.2
func (*RollbackError) Error ¶ added in v0.1.2
func (e *RollbackError) Error() string
Click to show internal directories.
Click to hide internal directories.