lpgxt

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conn

type Conn[T PGXQuerierConn] struct {
	// contains filtered or unexported fields
}

Conn wraps any implementation of PGXQuerierConn.

func NewConn

func NewConn[T PGXQuerierConn](querier T, options ...Option) *Conn[T]

NewConn wraps any implementation of PGXQuerierConn.

func (*Conn[T]) BeginTx

func (d *Conn[T]) BeginTx(ctx context.Context, txOptions pgx.TxOptions) (*Tx[pgx.Tx], error)

func (Conn) Prepare

func (d Conn) Prepare(ctx context.Context, name string, query litsql.Query) (*Stmt[T], error)

type Option

type Option func(options *dbOptions)

func WithQueryHandler

func WithQueryHandler(queryHandler sq.Handler) Option

type PGXQuerier

type PGXQuerier interface {
	Query(ctx context.Context, sql string, args ...any) (pgx.Rows, error)
	QueryRow(ctx context.Context, sql string, args ...any) pgx.Row
	Exec(ctx context.Context, sql string, args ...any) (commandTag pgconn.CommandTag, err error)
}

PGXQuerier is implemented by pgx.Conn, pgx.Tx, pgxpool.Pool, pgxpool.Conn and pgxpool.Tx.

type PGXQuerierConn

type PGXQuerierConn interface {
	PGXQuerierWithPrepare
	PGXQuerierPoolConn
}

PGXQuerierConn is implemented by pgx.Conn.

type PGXQuerierPool

type PGXQuerierPool interface {
	PGXQuerier
	BeginTx(ctx context.Context, txOptions pgx.TxOptions) (pgx.Tx, error)
}

PGXQuerierPool is implemented by pgx.Conn, pgxpool.Pool and pgxpool.Conn.

type PGXQuerierPoolConn

type PGXQuerierPoolConn interface {
	PGXQuerier
	PGXQuerierPool
}

PGXQuerierPoolConn is implemented by pgx.Conn and pgxpool.Conn.

type PGXQuerierTx

type PGXQuerierTx interface {
	PGXQuerierWithPrepare
	Begin(ctx context.Context) (pgx.Tx, error)
	Commit(ctx context.Context) error
	Rollback(ctx context.Context) error
}

PGXQuerierTx is implemented by pgx.Tx and pgxpool.Tx.

type PGXQuerierWithPrepare

type PGXQuerierWithPrepare interface {
	PGXQuerier
	Prepare(ctx context.Context, name, sql string) (sd *pgconn.StatementDescription, err error)
}

PGXQuerierWithPrepare is implemented by pgx.Conn, pgx.Tx and pgxpool.Tx.

type Pool

type Pool[T PGXQuerierPool] struct {
	// contains filtered or unexported fields
}

Pool wraps any implementation of PGXQuerierPool.

func NewPool

func NewPool[T PGXQuerierPool](querier T, options ...Option) *Pool[T]

NewPool wraps any implementation of PGXQuerierPool.

func (*Pool[T]) BeginTx

func (d *Pool[T]) BeginTx(ctx context.Context, txOptions pgx.TxOptions) (*Tx[pgx.Tx], error)

func (Pool) Exec

func (d Pool) Exec(ctx context.Context, query litsql.Query, params litsql.ArgValues) (pgconn.CommandTag, error)

func (Pool) Handler

func (d Pool) Handler() T

func (Pool) Query

func (d Pool) Query(ctx context.Context, query litsql.Query, params litsql.ArgValues) (pgx.Rows, error)

func (Pool) QueryRow

func (d Pool) QueryRow(ctx context.Context, query litsql.Query, params litsql.ArgValues) (pgx.Row, error)

type PoolConn

type PoolConn[T PGXQuerierPoolConn] struct {
	// contains filtered or unexported fields
}

PoolConn wraps any implementation of PGXQuerierPoolConn.

func NewPoolConn

func NewPoolConn[T PGXQuerierPoolConn](querier T, options ...Option) *PoolConn[T]

NewPoolConn wraps any implementation of PGXQuerierPoolConn.

func (*PoolConn[T]) BeginTx

func (d *PoolConn[T]) BeginTx(ctx context.Context, txOptions pgx.TxOptions) (*Tx[pgx.Tx], error)

func (PoolConn) Exec

func (d PoolConn) Exec(ctx context.Context, query litsql.Query, params litsql.ArgValues) (pgconn.CommandTag, error)

func (PoolConn) Handler

func (d PoolConn) Handler() T

func (PoolConn) Query

func (d PoolConn) Query(ctx context.Context, query litsql.Query, params litsql.ArgValues) (pgx.Rows, error)

func (PoolConn) QueryRow

func (d PoolConn) QueryRow(ctx context.Context, query litsql.Query, params litsql.ArgValues) (pgx.Row, error)

type Querier

type Querier interface {
	Query(ctx context.Context, query litsql.Query, params litsql.ArgValues) (pgx.Rows, error)
	QueryRow(ctx context.Context, query litsql.Query, params litsql.ArgValues) (pgx.Row, error)
	Exec(ctx context.Context, query litsql.Query, params litsql.ArgValues) (pgconn.CommandTag, error)
}

type QuerierConn

type QuerierConn[T PGXQuerier] interface {
	QuerierWithPrepare[T]
	QuerierPoolConn
}

type QuerierPool

type QuerierPool interface {
	Querier
	BeginTx(ctx context.Context, opts pgx.TxOptions) (*Tx[pgx.Tx], error)
}

type QuerierPoolConn

type QuerierPoolConn interface {
	Querier
	QuerierPool
	BeginTx(ctx context.Context, opts pgx.TxOptions) (*Tx[pgx.Tx], error)
}

type QuerierStmt

type QuerierStmt interface {
	Query(ctx context.Context, params litsql.ArgValues) (pgx.Rows, error)
	QueryRow(ctx context.Context, params litsql.ArgValues) (pgx.Row, error)
	Exec(ctx context.Context, params litsql.ArgValues) (pgconn.CommandTag, error)
}

type QuerierTx

type QuerierTx[T PGXQuerier] interface {
	QuerierWithPrepare[T]
	Begin(ctx context.Context) (*Tx[pgx.Tx], error)
	Commit(ctx context.Context) error
	Rollback(ctx context.Context) error
}

type QuerierWithPrepare

type QuerierWithPrepare[T PGXQuerier] interface {
	Querier
	Prepare(ctx context.Context, name string, query litsql.Query) (*Stmt[T], error)
}

type Stmt

type Stmt[T PGXQuerier] struct {
	// contains filtered or unexported fields
}

Stmt wraps a PGXQuerier with a statement description from a Prepare call.

func NewStmt

func NewStmt[T PGXQuerier](querier T, desc *pgconn.StatementDescription, args []any, options ...Option) *Stmt[T]

NewStmt wraps a PGXQuerier with a statement description from a Prepare call.

func (*Stmt[T]) Exec

func (d *Stmt[T]) Exec(ctx context.Context, params litsql.ArgValues) (pgconn.CommandTag, error)

func (*Stmt[T]) Handler

func (d *Stmt[T]) Handler() T

func (*Stmt[T]) Query

func (d *Stmt[T]) Query(ctx context.Context, params litsql.ArgValues) (pgx.Rows, error)

func (*Stmt[T]) QueryRow

func (d *Stmt[T]) QueryRow(ctx context.Context, params litsql.ArgValues) (pgx.Row, error)

type Tx

type Tx[T PGXQuerierTx] struct {
	// contains filtered or unexported fields
}

Tx wraps any implementation of PGXQuerierTx.

func NewTx

func NewTx[T PGXQuerierTx](querier T, options ...Option) *Tx[T]

NewTx wraps any implementation of PGXQuerierTx.

func (*Tx[T]) Begin

func (d *Tx[T]) Begin(ctx context.Context) (*Tx[pgx.Tx], error)

func (*Tx[T]) Commit

func (d *Tx[T]) Commit(ctx context.Context) error

func (Tx) Prepare

func (d Tx) Prepare(ctx context.Context, name string, query litsql.Query) (*Stmt[T], error)

func (*Tx[T]) Rollback

func (d *Tx[T]) Rollback(ctx context.Context) error

Jump to

Keyboard shortcuts

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