Documentation
¶
Index ¶
- Variables
- func NewPGXLocks(ctx context.Context, db PGXInterface, lockIDs ...string) error
- func Transaction(ctx context.Context, db *pgx.Conn, do func(tx pgx.Tx) error, ...) error
- func WithAdvisoryLock(key string) func(*Options)
- func WithLockTimeout(timeoutSeconds uint8) func(*Options)
- type AcquiredLocks
- type Options
- type PGXInterface
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrCouldNotAcquireLock = errors.New("could not acquire database lock")
)
Functions ¶
func NewPGXLocks ¶
func NewPGXLocks(ctx context.Context, db PGXInterface, lockIDs ...string) error
NewPGXLocks acquire pg_advisory_xact_lock locks for each lockID given. Duplicates in lockIDs getting filtered out.
func Transaction ¶
func Transaction( ctx context.Context, db *pgx.Conn, do func(tx pgx.Tx) error, options ...func(*Options), ) error
Transaction opens a transaction with the possibility of special options that are bound to it. The code that runs in the do parameter function is fully transactional with all its options.
func WithAdvisoryLock ¶
WithAdvisoryLock this option configures advisory locks to the given transaction.
func WithLockTimeout ¶
WithLockTimeout this option configures the local lock timeout.
Types ¶
type AcquiredLocks ¶
type AcquiredLocks struct {
IDs []string
}
type PGXInterface ¶
Click to show internal directories.
Click to hide internal directories.