gormuow

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnitOfWorkUnavailable     = errors.New("gorm unit of work unavailable")
	ErrActiveTransactionRequired = errors.New("gorm active transaction required")
)

Functions

func AfterCommit

func AfterCommit(ctx context.Context, hook func(context.Context) error) error

func RequireTx

func RequireTx(ctx context.Context) (*gorm.DB, error)

func TxFromContext

func TxFromContext(ctx context.Context) (*gorm.DB, bool)

func WithContext

func WithContext(ctx context.Context, db *gorm.DB) *gorm.DB

func WithTx

func WithTx(ctx context.Context, tx *gorm.DB) context.Context

Types

type TxOptions

type TxOptions struct {
	Name      string
	ReadOnly  bool
	Isolation sql.IsolationLevel
}

type UnitOfWork

type UnitOfWork struct {
	// contains filtered or unexported fields
}

func NewUnitOfWork

func NewUnitOfWork(db *gorm.DB) *UnitOfWork

func (*UnitOfWork) WithinTransaction

func (u *UnitOfWork) WithinTransaction(ctx context.Context, fn func(txCtx context.Context) error, opts ...TxOptions) error

Jump to

Keyboard shortcuts

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