runtime

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2025 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 Batch

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

Batch represents a batch of operations

func NewBatch

func NewBatch(pool *pgxpool.Pool) *Batch

NewBatch creates a new batch

func (*Batch) Queue

func (b *Batch) Queue(sql string, args ...interface{})

Queue adds a query to the batch

func (*Batch) Send

func (b *Batch) Send(ctx context.Context) (BatchResults, error)

Send sends the batch and returns results

type BatchResults

type BatchResults interface {
	// Exec reads the results from the next query in the batch
	Exec() (pgconn.CommandTag, error)

	// Query reads the results from the next query in the batch
	Query() (pgx.Rows, error)

	// QueryRow reads the results from the next query in the batch
	QueryRow() pgx.Row

	// Close closes the batch results
	Close() error
}

type Predicate

type Predicate interface {
	String() string
	Args() []interface{}
}

Predicate represents a SQL predicate

func And

func And(predicates ...Predicate) Predicate

And combines predicates with AND

func Contains

func Contains(field, value string) Predicate

Contains creates a LIKE predicate for substring match

func EQ

func EQ(field string, value interface{}) Predicate

EQ creates an equality predicate

func GT

func GT(field string, value interface{}) Predicate

GT creates a greater-than predicate

func GTE

func GTE(field string, value interface{}) Predicate

GTE creates a greater-than-or-equal predicate

func HasEdge

func HasEdge(edge string) Predicate

HasEdge creates a predicate to check if a relationship exists

func HasEdgeWith

func HasEdgeWith(edge string, predicates ...Predicate) Predicate

HasEdgeWith creates a predicate to filter by relationship

func HasPrefix

func HasPrefix(field, value string) Predicate

HasPrefix creates a LIKE predicate for prefix match

func HasSuffix

func HasSuffix(field, value string) Predicate

HasSuffix creates a LIKE predicate for suffix match

func In

func In(field string, values ...interface{}) Predicate

In creates an IN predicate

func IsNull

func IsNull(field string) Predicate

IsNull creates an IS NULL predicate

func LT

func LT(field string, value interface{}) Predicate

LT creates a less-than predicate

func LTE

func LTE(field string, value interface{}) Predicate

LTE creates a less-than-or-equal predicate

func NEQ

func NEQ(field string, value interface{}) Predicate

NEQ creates a not-equal predicate

func Not

func Not(predicate Predicate) Predicate

Not negates a predicate

func NotIn

func NotIn(field string, values ...interface{}) Predicate

NotIn creates a NOT IN predicate

func NotNull

func NotNull(field string) Predicate

NotNull creates an IS NOT NULL predicate

func Or

func Or(predicates ...Predicate) Predicate

Or combines predicates with OR

type Query

type Query interface {
	Where(predicates ...Predicate) Query
}

Query is the interface for query builders

type Tx

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

Tx wraps a pgx transaction

func BeginTx

func BeginTx(ctx context.Context, pool *pgxpool.Pool) (*Tx, error)

BeginTx starts a new transaction

func (*Tx) Commit

func (t *Tx) Commit(ctx context.Context) error

Commit commits the transaction

func (*Tx) Exec

func (t *Tx) Exec(ctx context.Context, sql string, args ...interface{}) (pgconn.CommandTag, error)

func (*Tx) Query

func (t *Tx) Query(ctx context.Context, sql string, args ...interface{}) (pgx.Rows, error)

Query executes a query in the transaction

func (*Tx) QueryRow

func (t *Tx) QueryRow(ctx context.Context, sql string, args ...interface{}) pgx.Row

QueryRow executes a query in the transaction

func (*Tx) Rollback

func (t *Tx) Rollback(ctx context.Context) error

Rollback rolls back the transaction

Jump to

Keyboard shortcuts

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