Documentation
¶
Index ¶
- func AdvisoryTransactionLock(ctx context.Context, executor CommandExecutor, key string) error
- func InTransaction(ctx context.Context, pool *pgxpool.Pool, operation func(pgx.Tx) error) error
- func NewPool(ctx context.Context, config Config) (*pgxpool.Pool, error)
- func OpenSQL(config Config) (*sql.DB, error)
- type CommandExecutor
- type Config
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AdvisoryTransactionLock ¶ added in v0.4.0
func AdvisoryTransactionLock(ctx context.Context, executor CommandExecutor, key string) error
AdvisoryTransactionLock obtains a transaction-scoped PostgreSQL advisory lock for a stable application key. The caller must execute it inside an active transaction; PostgreSQL releases the lock when that transaction ends.
func InTransaction ¶ added in v0.2.0
InTransaction runs operation in a transaction and automatically commits or rolls it back.
Types ¶
type CommandExecutor ¶ added in v0.4.0
CommandExecutor is implemented by pgx connections, pools and transactions.
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config contains PostgreSQL connection settings loaded from the ProcessModule runtime environment.
func LoadConfig ¶
LoadConfig loads PostgreSQL connection settings from environment variables and reads the password from a secret file.
Click to show internal directories.
Click to hide internal directories.