query

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2024 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalid = errors.New("invalid query")

Functions

func Unwrap

func Unwrap(builder squirrel.Sqlizer) (string, []interface{}, error)

Types

type Builder

type Builder struct {
	squirrel.StatementBuilderType
}

func NewBuilder

func NewBuilder() Builder

type Executor

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

func NewExecutor

func NewExecutor(executor Runner) *Executor

func (*Executor) Delete

func (r *Executor) Delete(ctx context.Context, builder squirrel.DeleteBuilder) (int64, error)

func (*Executor) ExecuteRaw

func (r *Executor) ExecuteRaw(ctx context.Context, query string, args ...any) (rowsAffected int64, err error)

func (*Executor) GetRaw

func (r *Executor) GetRaw(ctx context.Context, dst any, query string, args ...any) error

func (*Executor) Insert

func (r *Executor) Insert(ctx context.Context, builder squirrel.InsertBuilder) (int64, error)

func (*Executor) SelectRaw

func (r *Executor) SelectRaw(ctx context.Context, dst any, query string, args ...any) error

func (*Executor) Update

func (r *Executor) Update(ctx context.Context, builder squirrel.UpdateBuilder) (int64, error)

type Runner

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

Jump to

Keyboard shortcuts

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