postgres

package
v0.0.0-...-1ffe831 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2024 License: MIT Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound      = errors.New("entity not found")
	ErrAlreadyExists = errors.New("entity already exists")
)

Functions

func Builder

func Builder() sq.StatementBuilderType

func Connect

func Connect(ctx context.Context, pgDsn string) (*pgxpool.Pool, error)

func Exec

func Exec[T any](ctx context.Context, db pgxscan.Querier, sqlizer sq.Sqlizer) (*T, error)

func ExecWithOutbox

func ExecWithOutbox(ctx context.Context, db *pgxpool.Pool, dst Model, sqlizer sq.Sqlizer) error

func Select

func Select[T any](ctx context.Context, db pgxscan.Querier, sqlizer sq.Sqlizer) ([]*T, error)

func WithTransaction

func WithTransaction(ctx context.Context, pool *pgxpool.Pool, callback func(tx pgx.Tx) error) error

Types

type Model

type Model interface {
	TableName() string
}

type Pagination

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

func NewPagination

func NewPagination(page, perPage uint64) Pagination

func (*Pagination) Limit

func (p *Pagination) Limit() uint64

func (*Pagination) Offset

func (p *Pagination) Offset() uint64

Jump to

Keyboard shortcuts

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