sqlxtx

package module
v0.0.0-...-e807a05 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2024 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotTransaction = errors.New("sqltx: underlying type is not a transaction")

Functions

func IsTx

func IsTx(ctx context.Context) bool

func IsolationLevel

func IsolationLevel(ctx context.Context, isoLevel sql.IsolationLevel) context.Context

func ReadOnly

func ReadOnly(ctx context.Context, readOnly bool) context.Context

func TxOptions

func TxOptions(ctx context.Context) *sql.TxOptions

Types

type Atomic

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

func New

func New(db *sqlx.DB, fns ...func(DBTX) DBTX) *Atomic

func (*Atomic) DB

func (a *Atomic) DB() DBTX

func (*Atomic) DBTx

func (a *Atomic) DBTx(ctx context.Context) DBTX

func (*Atomic) RunInTx

func (a *Atomic) RunInTx(ctx context.Context, fn func(context.Context) error) (err error)

func (*Atomic) Tx

func (a *Atomic) Tx(ctx context.Context) DBTX

type DBTX

type DBTX = sqlx.ExtContext

DBTX represents the common db operations for both *sql.DB and *sql.Tx.

func Value

func Value(ctx context.Context) (DBTX, bool)

type Tx

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

Jump to

Keyboard shortcuts

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