postgres

package
v0.0.0-...-af6c1de Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CallTx

func CallTx[R any](ctx context.Context, db *sql.DB, f func(q *sql.Tx) (*R, error)) (*R, error)

func IsUniqueViolation

func IsUniqueViolation(err error) bool

IsUniqueViolation check if error is a unique constraint violation error

func IsUniqueViolationByField

func IsUniqueViolationByField(err error, field string) bool

IsUniqueViolationByField check if error is a unique constraint violation error by field

func Sorting

func Sorting(field, direction string) string

Types

type PaginationResult

type PaginationResult struct {
	Limit  int32
	Offset int32
}

func Pagination

func Pagination(page, perPage string) PaginationResult

type Storage

type Storage struct {
	Client *sql.DB
}

func New

func New(client *sql.DB) *Storage

func (*Storage) Cleanup

func (s *Storage) Cleanup() error

Jump to

Keyboard shortcuts

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