Documentation
¶
Index ¶
- Constants
- Variables
- func Count(ctx context.Context, querier Querier, sql string, args ...any) (int64, error)
- func CountT(ctx context.Context, querier Querier, templ *Template, data map[string]any) (int64, error)
- func Exec(ctx context.Context, querier Querier, sql string, args ...any) (int64, error)
- func ExecT(ctx context.Context, querier Querier, templ *Template, data map[string]any) (int64, error)
- func ListT[T any](ctx context.Context, querier Querier, templ *Template, data map[string]any, ...) (*pagination.Result[*T], error)
- func NilableArray[T any](a pgtype.Array[T]) nilable.Slice[T]
- func NilableBool(b pgtype.Bool) nilable.Value[bool]
- func NilableFlatArray[T any](a pgtype.FlatArray[T]) nilable.Slice[T]
- func NilableFloat4[T ~float32](n pgtype.Float4) nilable.Value[T]
- func NilableFloat8[T ~float64](n pgtype.Float8) nilable.Value[T]
- func NilableIPAddr(ip netip.Addr) nilable.Value[netip.Addr]
- func NilableInt2[T ~int16](n pgtype.Int2) nilable.Value[T]
- func NilableInt4[T ~int | ~int32](n pgtype.Int4) nilable.Value[T]
- func NilableInt8[T ~int64](n pgtype.Int8) nilable.Value[T]
- func NilableJSON(value map[string]any) nilable.Map[string, any]
- func NilablePoint[T any](p pgtype.Point, fn func(pgtype.Point) T) nilable.Value[T]
- func NilableText[T ~string](t pgtype.Text) nilable.Value[T]
- func NilableTimestamp(t pgtype.Timestamp) nilable.Value[time.Time]
- func NilableUUID[T ~string](u pgtype.UUID) nilable.Value[T]
- func NormalizeError(err error) error
- func ReadMany[T any](ctx context.Context, querier Querier, sql string, args ...any) ([]*T, error)
- func ReadManyT[T any](ctx context.Context, querier Querier, templ *Template, data map[string]any) ([]*T, error)
- func ReadOne[T any](ctx context.Context, querier Querier, sql string, args ...any) (*T, error)
- func ReadOneT[T any](ctx context.Context, querier Querier, templ *Template, data map[string]any) (*T, error)
- func RequiredArray[T any](a pgtype.Array[T]) []T
- func RequiredBool(b pgtype.Bool) bool
- func RequiredFlatArray[T any](a pgtype.FlatArray[T]) []T
- func RequiredFloat4[T ~float32](n pgtype.Float4) T
- func RequiredFloat8[T ~float64](n pgtype.Float8) T
- func RequiredIPAddr(ip netip.Addr) netip.Addr
- func RequiredInt2[T ~int16](n pgtype.Int2) T
- func RequiredInt4[T ~int | ~int32](n pgtype.Int4) T
- func RequiredInt8[T ~int64](n pgtype.Int8) T
- func RequiredJSON(value map[string]any) map[string]any
- func RequiredPoint[T any](p pgtype.Point, fn func(pgtype.Point) T) T
- func RequiredText[T ~string](t pgtype.Text) T
- func RequiredTimestamp(t pgtype.Timestamp) time.Time
- func RequiredUUID[T ~string](u pgtype.UUID) T
- func Time(t time.Time) time.Time
- func ToVec2(p pgtype.Point) pgtype.Vec2
- type Querier
- type Template
Constants ¶
View Source
const TimePrecision = time.Microsecond
Variables ¶
View Source
var ErrJoinNotEnded = fmt.Errorf("%w: join started but not ended", ErrTemplate)
View Source
var ErrJoinNotStarted = fmt.Errorf("%w: join not started", ErrTemplate)
View Source
var ErrTemplate = errors.New("postgres template")
View Source
var ErrTemplateFuncNotAvail = fmt.Errorf("%w: function not available in this execution context", ErrTemplate)
Functions ¶
func NilableFlatArray ¶ added in v1.4.0
func NilableFloat4 ¶ added in v1.3.0
func NilableFloat8 ¶ added in v1.3.0
func NilableInt4 ¶ added in v1.3.0
func NilablePoint ¶ added in v1.3.0
func NilableTimestamp ¶ added in v1.3.0
func NormalizeError ¶
func RequiredArray ¶
func RequiredBool ¶
func RequiredFlatArray ¶ added in v1.4.0
func RequiredFloat4 ¶ added in v1.3.0
func RequiredFloat8 ¶ added in v1.3.0
func RequiredInt2 ¶ added in v1.6.0
func RequiredInt8 ¶ added in v1.3.0
func RequiredPoint ¶ added in v1.3.0
func RequiredText ¶
func RequiredUUID ¶
Types ¶
type Querier ¶
type Querier interface { Begin(ctx context.Context) (pgx.Tx, error) Exec(ctx context.Context, sql string, arguments ...any) (commandTag pgconn.CommandTag, err error) Query(ctx context.Context, sql string, args ...any) (pgx.Rows, error) QueryRow(ctx context.Context, sql string, args ...any) pgx.Row }
type Template ¶
type Template struct {
// contains filtered or unexported fields
}
func (*Template) ExecuteCount ¶
Click to show internal directories.
Click to hide internal directories.