Documentation
¶
Index ¶
- type PgxDriver
- func (d *PgxDriver) Begin(ctx context.Context) (driver.Tx, error)
- func (d *PgxDriver) BeginTx(ctx context.Context, opts driver.TxOptions) (driver.Tx, error)
- func (d *PgxDriver) Close()
- func (d *PgxDriver) CopyFrom(ctx context.Context, table string, columns []string, rows [][]any) (int64, error)
- func (d *PgxDriver) Exec(ctx context.Context, sql string, args ...any) (int64, error)
- func (d *PgxDriver) Ping(ctx context.Context) error
- func (d *PgxDriver) Query(ctx context.Context, sql string, args ...any) (driver.Rows, error)
- func (d *PgxDriver) QueryRow(ctx context.Context, sql string, args ...any) driver.Row
- func (d *PgxDriver) SendBatch(ctx context.Context, items []driver.BatchItem) (driver.BatchResults, error)
- func (d *PgxDriver) Stat() driver.PoolStat
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 ¶
New creates a new PgxDriver by connecting to the given DSN. An optional PoolConfig overrides pool sizing/lifetime (DSN pool_* params still apply for fields left zero).
func NewLazy ¶ added in v0.5.0
NewLazy creates a PgxDriver without eagerly pinging the server. The pool is created immediately but connections are established on demand. Use this for read replicas where an initial connection failure should be surfaced at query time (and failed over) rather than preventing engine startup.
func (*PgxDriver) CopyFrom ¶ added in v0.5.0
func (d *PgxDriver) CopyFrom(ctx context.Context, table string, columns []string, rows [][]any) (int64, error)
CopyFrom performs a high-throughput bulk load via the pgx COPY protocol on a pooled connection. It implements driver.BulkCopier.
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.