Documentation ¶ Index ¶ func IDB(ctx context.Context, fallback bun.IDB) bun.IDB func RunInTx(ctx context.Context, db *bun.DB, fn func(ctx context.Context) error) error Constants ¶ This section is empty. Variables ¶ This section is empty. Functions ¶ func IDB ¶ func IDB(ctx context.Context, fallback bun.IDB) bun.IDB IDB returns the transaction stored in ctx by RunInTx, or fallback if there is none. func RunInTx ¶ func RunInTx(ctx context.Context, db *bun.DB, fn func(ctx context.Context) error) error RunInTx runs fn within a database transaction, stored in the returned context. Repositories should call IDB(ctx, db) to transparently use the transaction when present. The transaction commits if fn returns nil, and rolls back otherwise. Types ¶ This section is empty. Source Files ¶ View all Source files tx.go Click to show internal directories. Click to hide internal directories.