postgres

package
v0.0.0-...-29fb6bf Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2024 License: MIT Imports: 10 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 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 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