executor

package
v0.0.0-...-0b70e59 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Exec

func Exec(ctx context.Context, execer Execer, builder Builder) error

func Get

func Get[T any](ctx context.Context, querier Querier, builder Builder) (T, error)

func Select

func Select[T any](ctx context.Context, querier Querier, builder Builder) ([]T, error)

Types

type Builder

type Builder interface {
	ToSql() (query string, args []any, err error)
}

type Execer

type Execer interface {
	Exec(ctx context.Context, query string, args ...any) (pgconn.CommandTag, error)
}

type Executor

type Executor struct {
	*pgxpool.Pool
	pgx.Tx
}

func New

func New(ctx context.Context, dsn string) (*Executor, error)

func (*Executor) BeginTx

func (e *Executor) BeginTx(ctx context.Context) (context.Context, error)

func (*Executor) BeginTxWithOptions

func (e *Executor) BeginTxWithOptions(ctx context.Context, options pgx.TxOptions) (context.Context, error)

func (*Executor) CommitTx

func (e *Executor) CommitTx(ctx context.Context) error

func (*Executor) Execer

func (e *Executor) Execer(ctx context.Context) Execer

func (*Executor) Querier

func (e *Executor) Querier(ctx context.Context) Querier

func (*Executor) RollbackTx

func (e *Executor) RollbackTx(ctx context.Context)

type Querier

type Querier interface {
	Query(ctx context.Context, query string, args ...any) (pgx.Rows, error)
}

type TxStack

type TxStack interface {
	Push(tx pgx.Tx)
	Pop() pgx.Tx
	Peek() pgx.Tx
}

Jump to

Keyboard shortcuts

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