Documentation
¶
Index ¶
- func AdaptPgxConn(db PgxConn) adapter.DatabaseConn
- type PGXPoolConn
- type PGXQuerier
- type PgxAdapter
- func (pga *PgxAdapter) Begin(ctx context.Context) (internal.DatabaseConnTx, error)
- func (pga *PgxAdapter) Exec(ctx context.Context, query string, args ...any) (int64, error)
- func (pga *PgxAdapter) IsNoRowsError(err error) bool
- func (pga *PgxAdapter) IsTransaction() bool
- func (pga *PgxAdapter) IsTxDoneError(err error) bool
- func (pga *PgxAdapter) Query(ctx context.Context, query string, args ...any) (internal.DatabaseConnRows, error)
- func (pga *PgxAdapter) QueryRow(ctx context.Context, query string, args ...any) internal.DatabaseConnRow
- type PgxConn
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AdaptPgxConn ¶
func AdaptPgxConn(db PgxConn) adapter.DatabaseConn
AdaptPgxConn returns a databaseConn based on a pgx connection.
Note: when using transactions with pgx, the context passed to Begin impacts the creation of the transaction only.
Types ¶
type PGXPoolConn ¶
type PGXPoolConn interface {
PGXQuerier
Begin(ctx context.Context) (pgx.Tx, error)
BeginTx(ctx context.Context, txOptions pgx.TxOptions) (pgx.Tx, error)
Ping(ctx context.Context) error
Close()
}
Interface that applies to *pgxpool.Pool.
type PGXQuerier ¶
type PGXQuerier interface {
Exec(ctx context.Context, query string, args ...any) (pgconn.CommandTag, error)
Query(ctx context.Context, query string, args ...any) (pgx.Rows, error)
QueryRow(ctx context.Context, query string, args ...any) pgx.Row
}
Interface that contains methods for querying. Applies to *pgx.Conn, *pgxpool.Pool, and pgx.Tx
type PgxAdapter ¶
type PgxAdapter struct {
// contains filtered or unexported fields
}
PgxAdapter is an adapter for pgx connections.
func (*PgxAdapter) Begin ¶
func (pga *PgxAdapter) Begin(ctx context.Context) (internal.DatabaseConnTx, error)
func (*PgxAdapter) IsNoRowsError ¶
func (pga *PgxAdapter) IsNoRowsError(err error) bool
func (*PgxAdapter) IsTransaction ¶ added in v0.2.3
func (pga *PgxAdapter) IsTransaction() bool
func (*PgxAdapter) IsTxDoneError ¶ added in v0.2.2
func (pga *PgxAdapter) IsTxDoneError(err error) bool
func (*PgxAdapter) Query ¶ added in v0.2.1
func (pga *PgxAdapter) Query(ctx context.Context, query string, args ...any) (internal.DatabaseConnRows, error)
func (*PgxAdapter) QueryRow ¶
func (pga *PgxAdapter) QueryRow(ctx context.Context, query string, args ...any) internal.DatabaseConnRow
type PgxConn ¶
type PgxConn interface {
Begin(ctx context.Context) (pgx.Tx, error)
Query(ctx context.Context, query string, args ...any) (pgx.Rows, error)
QueryRow(ctx context.Context, query string, args ...any) pgx.Row
Exec(ctx context.Context, query string, args ...any) (pgconn.CommandTag, error)
}
PgxConn is the interface for connections that use pgx.
Click to show internal directories.
Click to hide internal directories.