Documentation
¶
Index ¶
- func AfterCommit(ctx context.Context, f func() error) error
- func Begin(ctx context.Context) (context.Context, transaction)
- func Do(ctx context.Context, f func(ctx context.Context) error) (err error)
- func Enable(db db) dbtx
- func ForceTx(ctx context.Context, db DBTX, f func(context.Context, TX) error) (err error)
- func IsActive(ctx context.Context) bool
- type DBTX
- type TX
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AfterCommit ¶ added in v0.11.0
AfterCommit registers f to run after the transaction of ctx is committed. f does not run if the transaction is rolled back. Without a transaction in ctx, f runs immediately.
f must not use the transaction. An error of f is returned by Commit, but the transaction stays committed.
Types ¶
type DBTX ¶
type DBTX interface {
ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error)
PrepareContext(ctx context.Context, query string) (*sql.Stmt, error)
QueryContext(ctx context.Context, query string, args ...any) (*sql.Rows, error)
QueryRowContext(ctx context.Context, query string, args ...any) *sql.Row
}
Click to show internal directories.
Click to hide internal directories.