qrbpgx

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2025 License: MIT Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExecutiveQueryBuilder

type ExecutiveQueryBuilder struct {
	*builder.QueryBuilder
	// contains filtered or unexported fields
}

func (*ExecutiveQueryBuilder) Exec

func (b *ExecutiveQueryBuilder) Exec(ctx context.Context) (commandTag pgconn.CommandTag, err error)

func (*ExecutiveQueryBuilder) Query

func (b *ExecutiveQueryBuilder) Query(ctx context.Context) (rows pgx.Rows, err error)

func (*ExecutiveQueryBuilder) QueryRow

func (b *ExecutiveQueryBuilder) QueryRow(ctx context.Context) (row pgx.Row, err error)

func (*ExecutiveQueryBuilder) WithNamedArgs added in v0.2.4

func (b *ExecutiveQueryBuilder) WithNamedArgs(args map[string]any) *ExecutiveQueryBuilder

func (*ExecutiveQueryBuilder) WithoutValidation added in v0.2.4

func (b *ExecutiveQueryBuilder) WithoutValidation() *ExecutiveQueryBuilder

type Executor

type Executor 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) (pgconn.CommandTag, error)
}

Executor is the interface that wraps the basic Query, QueryRow and Exec methods. It allows to use pgx conn, pool and tx as an executor.

type ExecutorBuilder

type ExecutorBuilder struct {
	// contains filtered or unexported fields
}

func NewExecutorBuilder

func NewExecutorBuilder(executor Executor) *ExecutorBuilder

NewExecutorBuilder starts with an Executor and allows to build an executable query via ExecutorBuilder.Build.

func (*ExecutorBuilder) Build

type QueryBuilder

type QueryBuilder struct {
	*builder.QueryBuilder
}

func Build

func Build(builder builder.SQLWriter) *QueryBuilder

Build a new QueryBuilder that can execute queries via pgx conn / tx after calling QueryBuilder.WithExecutor.

func (*QueryBuilder) WithExecutor

func (b *QueryBuilder) WithExecutor(executor Executor) *ExecutiveQueryBuilder

WithExecutor sets the executor to use for the query. It can be a pgx conn or tx.

Jump to

Keyboard shortcuts

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