with

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Close

func Close(cl Closer, fn func())

Close is a convenient wrapper for closing after performing some action

func Lock

func Lock(l Locker, fn func())

Lock simple wrapper for locking -> performing action -> unlocking

func Tx

func Tx(dbConn *sql.DB, fn TxFunc, opts ...*sql.TxOptions) error

Tx (with.Tx()) encapsulates common pattern of transaction.

func TxContext

func TxContext(ctx context.Context, dbConn *sql.DB, fn TxFunc, opts ...*sql.TxOptions) (err error)

TxContext encapsulates common pattern of transaction.

Types

type Closer

type Closer interface {
	Close() error
}

Closer interface with Close() error function

type Locker

type Locker interface {
	Lock()
	Unlock()
}

type TxFunc

type TxFunc func(tx *sql.Tx) error

TxFunc is func used to perform inside transaction.

Jump to

Keyboard shortcuts

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