Versions in this module Expand all Collapse all v0 v0.1.0 Apr 4, 2024 Changes in this version + var INT_SIZE = unsafe.Sizeof(int(0)) + var JSONMarshaler = json.Marshal + var JSONUnmarshaler = json.Unmarshal + var MAX_FLOAT32 float32 = 1<<31 - 1 + var MAX_FLOAT64 float64 = 1<<63 - 1 + var MAX_INT int = 1<<(INT_SIZE-1) - 1 + var MAX_INT16 int16 = 1<<15 - 1 + var MAX_INT32 int32 = 1<<31 - 1 + var MAX_INT64 int64 = 1<<63 - 1 + var MAX_INT8 int8 = 1<<7 - 1 + var MAX_UINT uint = 1<<(UINT_SIZE-1) - 1 + var MAX_UINT16 uint16 = 1<<15 - 1 + var MAX_UINT32 uint32 = 1<<31 - 1 + var MAX_UINT64 uint64 = 1<<63 - 1 + var MAX_UINT8 uint8 = 1<<7 - 1 + var MIN_FLOAT32 float32 = -1 << 31 + var MIN_FLOAT64 float64 = -1 << 63 + var MIN_INT int = -1 << (INT_SIZE - 1) + var MIN_INT16 int16 = -1 << 15 + var MIN_INT32 int32 = -1 << 31 + var MIN_INT64 int64 = -1 << 63 + var MIN_INT8 int8 = -1 << 7 + var TimeZero = time.Time + var UINT_SIZE = unsafe.Sizeof(uint(0)) + func After(str, sub string) string + func AllMatchNil(opts ...any) bool + func AllNil(opts ...any) bool + func AllNotNil(opts ...any) bool + func AllOptionalAndValid(objs ...Validable) bool + func AllPresentAndValid(objs ...Validable) bool + func AnyNil(opts ...any) bool + func AnyNotNil(opts ...any) bool + func CopyMap[Key comparable, Value any](target map[Key]Value) (ret map[Key]Value) + func CopySlice[Type any](slice []Type) []Type + func FilterSlice[Type any](slice []Type, matcher func(v Type) bool) (ret []Type) + func FlattenMap[Key comparable, Value any](target map[Key]Value) (ret []any) + func ForceCast[Type any](value any) Type + func IsPrimitive(typ reflect.Type) bool + func JoinMaps[Key comparable, Value any](maps ...map[Key]Value) (ret map[Key]Value) + func JoinSlices[Value any](slices ...[]Value) (ret []Value) + func MakeAny[T any]() T + func MapKeys[Key comparable, Value any](target map[Key]Value) (ret []Key) + func MapValues[Key comparable, Value any](target map[Key]Value) (ret []Value) + func MatchLTreeSegments(ltree []string, query []string) bool + func MaxValue[Type Number]() Type + func Max[Type Number](vals ...Type) Type + func MinValue[Type Number]() Type + func Min[Type Number](vals ...Type) Type + func MustAssert[T any](obj any) T + func NumberMatcher[T Number](test T) func(v T) bool + func OptionalAndValid(obj Validable) bool + func PeekSliceOldest[Type any](slice []Type, count int) []Type + func PeekSlice[Type any](slice []Type, count int) []Type + func PopMultipleFromSlice[Type any](slice []Type, count int) (remaining []Type, elements []Type) + func PopSlice[Type any](slice []Type) (remaining []Type, element Type) + func PresentAndValid(obj Validable) bool + func ProcessVar[Type Primitive](name string, defValue Type) Type + func RandomCode(n uint8) string + func RandomUpperCode(n uint8) string + func ResizeSlice[Type any](slice []Type, capacity int) []Type + func SetProcessVarEnvPrefix(str string) + func ShiftMultipleFromSlice[Type any](slice []Type, count int) (remaining []Type, elements []Type) + func ShiftSlice[Type any](slice []Type) (remaining []Type, element Type) + func SliceAny[Type any](slice []Type, matcher func(v Type) bool) bool + func SliceContains[Type any](slice []Type, matcher func(v Type) bool) bool + func SliceEvery[Type any](slice []Type, matcher func(v Type) bool) bool + func SliceFindFirst[Type any](slice []Type, matcher func(v Type) bool) (*Type, bool) + func SliceFindIndex[Type any](slice []Type, matcher func(v Type) bool) int + func SplitKeyValue[Key comparable, Value any](target map[Key]Value) (keys []Key, vals []Value) + func SplitSlice[Type any](slice []Type, matcher func(v Type) bool) (falses []Type, trues []Type) + func SplitStringByRune(str string, run rune) []string + func SplitStringsToMap(strs []string, sep string) (ret map[string]string) + func StringMatcher(test string) func(v string) bool + func StructProcessVar[Type any](prefix string, defValue Type) Type + func Ternary[Type any](cond bool, t Type, f Type) Type + func TransformMapKeys[Key comparable, Value any](target map[Key]Value, transform func(Key) Key) (ret map[Key]Value) + func TransformMapValues[Key comparable, Value any](target map[Key]Value, transform func(Value) Value) map[Key]Value + func UniquifyString(str string) (string, error) + type Date struct + func DateFromTime(t time.Time) Date + func DateNow() Date + func ParseDate(str string) (Date, error) + func (d *Date) Parse(str string) (err error) + func (d *Date) Scan(src any) error + func (d *Date) UnmarshalJSON(src []byte) error + func (d *Date) UnmarshalText(src []byte) error + func (d Date) Add(dur time.Duration) Date + func (d Date) After(other Date) bool + func (d Date) Age() int + func (d Date) Before(other Date) bool + func (d Date) Compare(other Date) (dif int) + func (d Date) Day() int + func (d Date) DurationBetween(other Date) time.Duration + func (d Date) Equal(other Date) bool + func (d Date) IsZero() bool + func (d Date) MarshalJSON() ([]byte, error) + func (d Date) MarshalText() ([]byte, error) + func (d Date) Month() int + func (d Date) String() string + func (d Date) Time() *time.Time + func (d Date) Value() (driver.Value, error) + func (d Date) Year() int + type EventManager struct + func NewEventManager[Payload any]() EventManager[Payload] + func (e *EventManager[Payload]) Add(cb func(payload Payload) bool) uint + func (e *EventManager[Payload]) Dispatch(payload Payload) + func (e *EventManager[Payload]) Remove(id uint) + type FixedArray struct + func NewFixedArray[Type any](size int, elems ...Type) FixedArray[Type] + func (a *FixedArray[Type]) Push(elems ...Type) + func (a *FixedArray[Type]) Reset() + func (a FixedArray[Type]) Copy() (ret FixedArray[Type]) + func (a FixedArray[Type]) Count() int + func (a FixedArray[Type]) Elements() (ret []Type) + func (a FixedArray[Type]) IsFull() bool + func (a FixedArray[Type]) MarshalJSON() ([]byte, error) + func (a FixedArray[Type]) Oldest() *Type + func (a FixedArray[Type]) Size() int + func (a FixedArray[Type]) Youngest() *Type + type Float interface + type Integer interface + type LTree string + func NewLTree(segments ...string) LTree + func (t LTree) Match(str string) bool + func (t LTree) Postfix(segments ...string) LTree + func (t LTree) Prefix(segments ...string) LTree + func (t LTree) Segments() []string + func (t LTree) String() string + type Number interface + type Primitive interface + type PriorityQueue struct + func NewPriorityQueue[Type any](capacity int) PriorityQueue[Type] + func (q *PriorityQueue[Type]) Capacity() int + func (q *PriorityQueue[Type]) Length() int + func (q *PriorityQueue[Type]) Peek(count int) []Type + func (q *PriorityQueue[Type]) Pop(count int) []Type + func (q *PriorityQueue[Type]) Push(items ...Type) int + func (q *PriorityQueue[Type]) Slice() []Type + type Uinteger interface + type Validable interface + Valid func() bool