bunutil

package
v0.9.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 24, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址