pkg

package
v1.5.6 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ReadOnly    = "readOnly"
	Transaction = "transaction"
)

Variables

This section is empty.

Functions

func IsActive

func IsActive(v interface{}) bool

func RegisterCommit

func RegisterCommit(ctx context.Context, key any, hook ...Hook)

func RegisterRollback

func RegisterRollback(ctx context.Context, key any, hook ...Hook)

func RunTransaction

func RunTransaction[T any](ctx context.Context, begin Begin, txFunc func(ctx context.Context, db *gorm.DB) (context.Context, T, error), key any, opts ...*sql.TxOptions) (res T, err error)

func WithTransaction

func WithTransaction() interface{}

Types

type Begin

type Begin func(ctx context.Context, opts ...*sql.TxOptions) *gorm.DB

type Hook

type Hook func(ctx context.Context)

type Hooks

type Hooks []Hook

func (Hooks) Invoke

func (h Hooks) Invoke(ctx context.Context)

type TransactionContainer added in v1.5.0

type TransactionContainer struct {
	DB              *gorm.DB
	TransactionType string
	// contains filtered or unexported fields
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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