Documentation
¶
Overview ¶
Package txpostgres provides transaction helpers over a DatabasePool.
WithinTx uses the caller context for application work and commit, but deferred rollback cleanup switches to a short-lived context without caller cancellation so timed-out or canceled requests still attempt to release the transaction cleanly. Missing pool wiring fails closed with ErrPoolNotConfigured instead of panicking.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrPoolNotConfigured = errors.New("database pool not configured")
ErrPoolNotConfigured reports that the transaction adapter was constructed without a database pool.
Functions ¶
Types ¶
type DBer ¶
type DBer interface {
Exec(ctx context.Context, sql string, args ...any) (ports.DatabaseResult, error)
Query(ctx context.Context, sql string, args ...any) (ports.DatabaseRows, error)
QueryRow(ctx context.Context, sql string, args ...any) ports.DatabaseRow
}
DBer is satisfied by transactions and the pool facade below.
Click to show internal directories.
Click to hide internal directories.