pgext

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2025 License: MIT Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PgxBeginner

type PgxBeginner struct {
	Pool *pgxpool.Pool
}

func (*PgxBeginner) Begin

func (pgb *PgxBeginner) Begin(ctx context.Context, rawopts ...any) (
	*gotx.Transaction[pgx.Tx], error,
)

type PostgresError

type PostgresError struct {
	*pgconn.PgError
}

func AsPostgresError

func AsPostgresError(err error) *PostgresError

func (*PostgresError) IsUniqueViolation

func (pe *PostgresError) IsUniqueViolation(col ...string) bool

type SelectBuilder

type SelectBuilder = func(sb *sqlbuilder.SelectBuilder)

type Table

type Table[T any] struct {
	Name  string
	Txer  *Transactor
	Log   *slog.Logger
	RowTo pgx.RowToFunc[T]
	// contains filtered or unexported fields
}

func (*Table[T]) Count added in v0.0.2

func (t *Table[T]) Count(ctx context.Context, builder ...SelectBuilder) (uint64, error)

func (*Table[T]) Find

func (t *Table[T]) Find(ctx context.Context, where ...SelectBuilder) (*T, error)

func (*Table[T]) FindAll

func (t *Table[T]) FindAll(ctx context.Context, builder ...SelectBuilder) ([]T, error)

func (*Table[T]) Insert

func (t *Table[T]) Insert(ctx context.Context, data []*T, returning ...bool) ([]T, error)

func (*Table[T]) InsertOne

func (t *Table[T]) InsertOne(ctx context.Context, record *T, returning ...bool) (*T, error)

func (*Table[T]) Update

func (t *Table[T]) Update(
	ctx context.Context,
	record any,
	builder UpdateBuilder,
	returning ...bool,
) ([]T, error)

type Transactor

type Transactor = gotx.Transactor[pgx.Tx]

func NewTransactor

func NewTransactor(pool *pgxpool.Pool) *Transactor

type UpdateBuilder

type UpdateBuilder = func(ub *sqlbuilder.UpdateBuilder)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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