dbx

package
v0.0.0-...-63997f1 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var StatementBuilder = squirrel.StatementBuilderType(builder.EmptyBuilder).PlaceholderFormat(squirrel.Dollar)
View Source
var TxContextKey contextKey = struct{}{}

Functions

func AdjustRelation

func AdjustRelation[S interface {
	Keyer
	comparable
}](
	prev, next []S,
	addFn, removeFn ChangeRelationFunc[S],
) error

func InTransaction

func InTransaction(ctx context.Context, db *pgxpool.Pool, fn func(ctx2 context.Context, tx pgx.Tx) error) error

func IsNoRows

func IsNoRows(err error) bool

func IsUniqueViolation

func IsUniqueViolation(err error, name string) bool

func NotValidEnumType

func NotValidEnumType(err error) bool

func QueryBatchSelect

func QueryBatchSelect(b *pgx.Batch, sb squirrel.SelectBuilder) error

func WithTransaction

func WithTransaction(ctx context.Context, tx pgx.Tx) context.Context

Types

type ChangeRelationFunc

type ChangeRelationFunc[S any] func(S) error

type Keyer

type Keyer interface {
	Key() any
}

type Queryable

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

func FromContext

func FromContext(ctx context.Context, def Queryable) Queryable

Jump to

Keyboard shortcuts

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