postgresadapter

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2026 License: MIT Imports: 6 Imported by: 1

Documentation

Index

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 (*PgxAdapter) Exec

func (pga *PgxAdapter) Exec(ctx context.Context, query string, args ...any) (int64, 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.

Jump to

Keyboard shortcuts

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