exec

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadRelations

func LoadRelations(ctx context.Context) bool

func SkipRelations

func SkipRelations(ctx context.Context) bool

func WithRelations

func WithRelations(ctx context.Context) context.Context

func WithSkipRelations

func WithSkipRelations(ctx context.Context) context.Context

Types

type DB

type DB 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
	CopyFrom(ctx context.Context, tableName pgx.Identifier, columnNames []string, rowSrc pgx.CopyFromSource) (int64, error)
}

type RelationLoader

type RelationLoader[S any] interface {
	Load(ctx context.Context, db DB, base S) error
}

type RelationProvider

type RelationProvider[S any] interface {
	Relations() []RelationLoader[S]
}

type Scanner

type Scanner[F types.ColumnAlias] interface {
	GetTarget(string) func() any
	GetSetter(F) func() set.ValueSetter[F]
	GetValue(F) func() any
}

type TableExecutor

type TableExecutor[T types.TableAlias, C types.ColumnAlias, S Scanner[C]] struct {
	// contains filtered or unexported fields
}

func NewTableExecutor

func NewTableExecutor[T types.TableAlias, C types.ColumnAlias, S Scanner[C]](
	alias T,
	allFields []C,
	scanFactory func() S,
) *TableExecutor[T, C, S]

func (*TableExecutor[T, C, S]) CopyFrom

func (t *TableExecutor[T, C, S]) CopyFrom(ctx context.Context, db DB, values []S, fields ...C) (int64, error)

func (*TableExecutor[T, C, S]) Execute

func (t *TableExecutor[T, C, S]) Execute(ctx context.Context, db DB, query types.Buildable) (int64, error)

func (*TableExecutor[T, C, S]) Query

func (t *TableExecutor[T, C, S]) Query(ctx context.Context, db DB, query types.Scannable) (trgs []S, err error)

func (*TableExecutor[T, C, S]) QueryRow

func (t *TableExecutor[T, C, S]) QueryRow(ctx context.Context, db DB, query types.Scannable) (trg S, err error)

Jump to

Keyboard shortcuts

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