stdtxpgxv5

package
v0.0.150 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 7, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package stdtxpgxv5 implements the stdtx.Driver for pgx/v5 postgres driver.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(db *pgxpool.Pool, opts ...Option) stdtx.Driver[pgx.Tx]

New implements the driver for pgx v5.

Types

type Option

type Option func(o *options)

Option configures the pgxv5 driver.

func AccessMode

func AccessMode(v pgx.TxAccessMode) Option

AccessMode configure the access mode for transactions created for the driver.

func BeginWithSQL

func BeginWithSQL(v TxBeginSQLFunc) Option

BeginWithSQL configure the access mode for transactions created for the driver.

func DiscourageSeqScan

func DiscourageSeqScan(v bool) Option

DiscourageSeqScan configure the access mode for transactions created for the driver.

func ExecQueryLoggingLevel added in v0.0.122

func ExecQueryLoggingLevel(v zapcore.Level) Option

ExecQueryLoggingLevel configures the level at which transaction's exec and query sql are logged.

func IsolationMode

func IsolationMode(v pgx.TxIsoLevel) Option

IsolationMode configure the access mode for transactions created for the driver.

func OnTxCommit added in v0.0.149

func OnTxCommit(v TxOnCommitFunc) Option

OnTxCommit configures a hook called right before the transaction is committed.

func TestForMaxQueryPlanCosts added in v0.0.122

func TestForMaxQueryPlanCosts(maxCost float64) Option

TestForMaxQueryPlanCosts will enable EXPLAIN on every query that is executed with the driver and fail when the cost of the resulting query is above the maximum. Together with the enable_seqscan=OFF it can help test of infefficient queries do to missing indexes.

type TxBeginSQLFunc

type TxBeginSQLFunc = func(context.Context, *strings.Builder, pgx.Tx) (*strings.Builder, error)

TxBeginSQLFunc is the signature for determining custom sql run at the start of the transaction.

type TxOnCommitFunc added in v0.0.150

type TxOnCommitFunc = func(context.Context, pgx.TxAccessMode, pgx.Tx) error

TxOnCommitFunc is the signature of a function called on commit.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL