pgxdriver

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PgxDriver

type PgxDriver struct {
	// contains filtered or unexported fields
}

PgxDriver implements driver.Driver using a pgxpool connection pool.

func New

func New(ctx context.Context, dsn string) (*PgxDriver, error)

New creates a new PgxDriver by connecting to the given DSN.

func (*PgxDriver) Begin

func (d *PgxDriver) Begin(ctx context.Context) (driver.Tx, error)

Begin starts a new database transaction with default options.

func (*PgxDriver) BeginTx

func (d *PgxDriver) BeginTx(ctx context.Context, opts driver.TxOptions) (driver.Tx, error)

BeginTx starts a new database transaction with the given options.

func (*PgxDriver) Close

func (d *PgxDriver) Close()

Close shuts down the connection pool.

func (*PgxDriver) Exec

func (d *PgxDriver) Exec(ctx context.Context, sql string, args ...any) (int64, error)

Exec executes a statement and returns the number of affected rows.

func (*PgxDriver) Query

func (d *PgxDriver) Query(ctx context.Context, sql string, args ...any) (driver.Rows, error)

Query executes a query that returns multiple rows.

func (*PgxDriver) QueryRow

func (d *PgxDriver) QueryRow(ctx context.Context, sql string, args ...any) driver.Row

QueryRow executes a query that returns at most one row.

func (*PgxDriver) SendBatch added in v0.3.0

func (d *PgxDriver) SendBatch(ctx context.Context, items []driver.BatchItem) (driver.BatchResults, error)

SendBatch sends all queued queries in a single pipelined round-trip using the pgx batch protocol. Results must be read in order via the returned BatchResults before it is closed.

Jump to

Keyboard shortcuts

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