Documentation
¶
Overview ¶
Package store provides shared Postgres helpers used across paper-board services. The primary entry is WithTx, a generic transaction wrapper that composes pgx.Tx semantics with strongly-typed return values.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithTx ¶
WithTx runs fn inside a database transaction. It begins a tx before fn is called; commits on nil error; rolls back on any non-nil error or panic. Context cancellation forces rollback. The result of fn is returned on success.
Usage:
res, err := store.WithTx(ctx, pool, func(tx pgx.Tx) (Result, error) {
if _, err := tx.Exec(ctx, "..."); err != nil {
return Result{}, err
}
return Result{...}, nil
})
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.