Documentation
¶
Overview ¶
Package serial allows an otherwise-concurrent use of a database pool to be transparently deoptimized into serial use of a single transaction.
Index ¶
- type Pool
- func (s *Pool) Begin(ctx context.Context) error
- func (s *Pool) Commit(ctx context.Context) error
- func (s *Pool) Exec(ctx context.Context, sql string, arguments ...any) (pgconn.CommandTag, error)
- func (s *Pool) Query(ctx context.Context, sql string, optionsAndArgs ...any) (pgx.Rows, error)
- func (s *Pool) QueryRow(ctx context.Context, sql string, optionsAndArgs ...any) pgx.Row
- func (s *Pool) Rollback(ctx context.Context) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Pool ¶
Pool is a wrapper around a database connection pool that concentrates database queries into a single transaction. This type is used when it is necessary to de-optimize concurrent database performance in favor of transactional consistency.
This type is internally synchronized, and the query method calls will block each other. Queries will also be blocked while there is an active pgx.Rows or un-scanned pgx.Row that has been returned from a query.
func (*Pool) Query ¶
Query implements types.StagingQuerier and can only be called after Begin. The Rows that are returned from this method must be closed, fully consumed, or encounter an error before other query methods will be allowed to proceed.