package crdbpgx

import "github.com/cockroachdb/cockroach-go/crdb/crdbpgx"

Index

Functions

func ExecuteTx

func ExecuteTx(
	ctx context.Context, conn Conn, txOptions pgx.TxOptions, fn func(pgx.Tx) error,
) error

ExecuteTx runs fn inside a transaction and retries it as needed. On non-retryable failures, the transaction is aborted and rolled back; on success, the transaction is committed.

See crdb.ExecuteTx() for more information.

conn can be a pgx.Conn or a pgxpool.Pool.

Types

type Conn

type Conn interface {
	Begin(context.Context) (pgx.Tx, error)
	BeginTx(context.Context, pgx.TxOptions) (pgx.Tx, error)
}

Conn abstracts pgx transactions creators: pgx.Conn and pgxpool.Pool.

Source Files

pgx.go

Version
v2.0.1+incompatible (latest)
Published
Jun 23, 2020
Platform
darwin/amd64
Imports
3 packages
Last checked
8 hours ago

Tools for package owners.