util

package
v0.0.0-...-37b4917 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2025 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	SQLOpAND            = simpleOp("AND")
	SQLOpOR             = simpleOp("OR")
	SQLBinOpEQ          = simpleOp("=")
	SQLBinOpNEQ         = simpleOp("!=")
	SQLBinOpGT          = simpleOp(">")
	SQLBinOpGTE         = simpleOp(">=")
	SQLBinOpLT          = simpleOp("<")
	SQLBinOpLTE         = simpleOp("<=")
	SQLBinOpContains    = simpleOp("&&")
	SQLBinOpNotContains = SQLBinOpContains.Neg()
)

Functions

func EchoAllParams

func EchoAllParams[T any](c echo.Context, fn func(string) (T, error), params ...string) ([]T, error)

func NewEchoPgxHTTPError

func NewEchoPgxHTTPError(err error) *echo.HTTPError

func ParseUint32

func ParseUint32(s string) (uint32, error)

func ParseUint8

func ParseUint8(s string) (uint8, error)

func SQLParam

func SQLParam(num int) string

func SQLParams

func SQLParams(nums []int) []string

func Unique

func Unique[T comparable](s []T) []T

func UnixZero

func UnixZero() time.Time

Types

type SQLBuilder

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

func NewSQLBuilder

func NewSQLBuilder(offset int) *SQLBuilder

func (*SQLBuilder) Add

func (b *SQLBuilder) Add(v any, expr func(int) string)

func (*SQLBuilder) AddSlice

func (b *SQLBuilder) AddSlice(v []any, expr func([]int) string)

func (*SQLBuilder) Get

func (b *SQLBuilder) Get() ([]string, []any)

type SQLOp

type SQLOp func(lhs, rhs string) string

func (SQLOp) Neg

func (op SQLOp) Neg() SQLOp

type Set

type Set[T comparable] map[T]struct{}

func NewSet

func NewSet[T comparable](values ...T) Set[T]

func (Set[T]) Add

func (s Set[T]) Add(v T) bool

func (Set[T]) Contains

func (s Set[T]) Contains(v T) bool

func (Set[T]) ContainsAll

func (s Set[T]) ContainsAll(other Set[T]) bool

func (Set[T]) Intersect

func (s Set[T]) Intersect(other Set[T]) Set[T]

func (Set[T]) Remove

func (s Set[T]) Remove(v T) bool

Jump to

Keyboard shortcuts

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