conn

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WrapConn

func WrapConn(conn PgxConn, scanAPI *pgxscan.API) *wrappedConn

Types

type PgxConn

type PgxConn interface {
	Begin(context.Context) (pgx.Tx, error)
	BeginFunc(ctx context.Context, f func(pgx.Tx) error) (err error)
	Exec(ctx context.Context, sql string, arguments ...interface{}) (pgconn.CommandTag, error)
	Query(ctx context.Context, sql string, optionsAndArgs ...interface{}) (pgx.Rows, error)
	QueryRow(ctx context.Context, sql string, optionsAndArgs ...interface{}) pgx.Row
	QueryFunc(ctx context.Context, sql string, args, scans []interface{}, f func(pgx.QueryFuncRow) error) (pgconn.CommandTag, error)
	SendBatch(ctx context.Context, b *pgx.Batch) pgx.BatchResults
	CopyFrom(ctx context.Context, tableName pgx.Identifier, columnNames []string, rowSrc pgx.CopyFromSource) (int64, error)
}

type Querier

type Querier interface {
	Select(ctx context.Context, dst interface{}, sql string, args ...interface{}) error
	Get(ctx context.Context, dst interface{}, sql string, args ...interface{}) error
	Exec(ctx context.Context, sql string, args ...interface{}) (int64, error)
	Tx(ctx context.Context, f func(q Querier) error, opts ...TxOption) error
	Conn() PgxConn
}

type TxOption

type TxOption func(*TxOptions)

Option func.

func StatementTimeout

func StatementTimeout(d time.Duration) TxOption

StatementTimeout sets transaction statement_timeout.

func TransactionTimeout

func TransactionTimeout(d time.Duration) TxOption

TransactionTimeout sets idle_in_transaction_session_timeout.

type TxOptions

type TxOptions struct {
	TransactionTimeout int64
	StatementTimeout   int64
}

Options for tx.

Jump to

Keyboard shortcuts

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