Documentation
¶
Index ¶
- Variables
- func NewConnOnlyTx(conn *pgxpool.Conn, lg *zap.Logger, timeout time.Duration) *sqldriver.ConnOnlyTx[pgx.Rows]
- func NewRows(pgxRows pgx.Rows) driver.Rows
- type Driver
- func (d *Driver) Begin(ctx context.Context, isolation config.TxIsolationLevel) (driver.Tx, error)
- func (*Driver) ClassifyError(err error) driver.ErrorFacts
- func (d *Driver) Insert(ctx context.Context, req *driver.InsertRequest) (*stats.Query, error)
- func (d *Driver) OpenSession(ctx context.Context) (driver.Session, error)
- func (d *Driver) PoolMaxConns() int
- func (d *Driver) RunQuery(ctx context.Context, sql string, args map[string]any) (*driver.QueryResult, error)
- func (d *Driver) RunRoutine(ctx context.Context, isolation config.TxIsolationLevel, query string, ...) (*driver.QueryResult, error)
- func (d *Driver) SessionCapacity() int
- func (d *Driver) Teardown(ctx context.Context) error
- type Executor
- type PgxDialect
- type Rows
Constants ¶
This section is empty.
Variables ¶
var ErrColumnCountMismatch = errors.New("postgres: describe column count mismatch")
ErrColumnCountMismatch is returned by the columnar path when the server Describe reports a different column count than the source declared.
var ErrEmptyColumnOrder = errors.New("postgres: source reports zero columns")
ErrEmptyColumnOrder is returned by the bulk insert path when the source reports zero columns; a multi-row INSERT would be degenerate without them.
var ErrUnregisteredColumnType = errors.New("postgres: unregistered column type OID")
ErrUnregisteredColumnType is returned by the columnar path when a target column has a type OID that pgx's type map cannot name for the array cast.
var ErrUnsupportedInsertMethod = errors.New("postgres: unsupported insert method")
ErrUnsupportedInsertMethod is returned when an insert request selects a method the PostgreSQL driver cannot serve.
var ErrUnsupportedType = errors.New("unsupported value type")
ErrUnsupportedType is returned when a query value has an unrecognized type.
Functions ¶
func NewConnOnlyTx ¶
Types ¶
type Driver ¶
type Driver struct {
// contains filtered or unexported fields
}
func (*Driver) ClassifyError ¶
func (*Driver) ClassifyError(err error) driver.ErrorFacts
func (*Driver) Insert ¶
Insert runs a typed driver.InsertRequest through the postgres driver. Each worker prepares a gen.Cursor partition, adapts it to a source.RowSource, and drains it through runInsertChunk. Generation is allocation-free after preparation; driver-side row materialization and COPY or bulk encoding may allocate.
func (*Driver) OpenSession ¶ added in v6.3.0
func (*Driver) PoolMaxConns ¶ added in v6.3.0
func (*Driver) RunQuery ¶
func (d *Driver) RunQuery( ctx context.Context, sql string, args map[string]any, ) (*driver.QueryResult, error)
RunQuery executes sql with named :arg placeholders and returns rows cursor.
func (*Driver) RunRoutine ¶ added in v6.3.3
func (*Driver) SessionCapacity ¶ added in v6.3.0
type Executor ¶
type Executor interface {
Exec(ctx context.Context, sql string, arguments ...any) (pgconn.CommandTag, error)
ExecContext(ctx context.Context, sql string, arguments ...any) (pgconn.CommandTag, error)
Query(ctx context.Context, sql string, args ...any) (pgx.Rows, error)
QueryContext(ctx context.Context, sql string, args ...any) (pgx.Rows, error)
CopyFrom(
ctx context.Context,
tableName pgx.Identifier,
columnNames []string,
rowSrc pgx.CopyFromSource,
) (int64, error)
BeginTx(ctx context.Context, txOptions pgx.TxOptions) (pgx.Tx, error)
Acquire(ctx context.Context) (*pgxpool.Conn, error)
Ping(ctx context.Context) error
Config() *pgxpool.Config
Close()
}
type PgxDialect ¶
type PgxDialect struct{}
PgxDialect implements sqlqueries.Dialect for PostgreSQL via pgx.
func (PgxDialect) Deduplicate ¶
func (PgxDialect) Deduplicate() bool
func (PgxDialect) Placeholder ¶
func (PgxDialect) Placeholder(index int) string
func (PgxDialect) StatementDeadline ¶
func (PgxDialect) StatementDeadline(timeout time.Duration) time.Duration
StatementDeadline returns timeout unchanged; there is no server-side hint to outlast, so the client deadline is the timeout itself.
func (PgxDialect) StatementTimeoutHint ¶
StatementTimeoutHint returns sql unchanged: pgx already turns a deadline into a PostgreSQL CancelRequest, so no session-level statement_timeout (and no pooled-connection state to leak) is needed.