Versions in this module Expand all Collapse all v0 v0.19.4 Nov 1, 2026 Changes in this version + func Abs[T types.Numerical](x T) T + func AddUniqueSlice[T comparable](slice []T, items ...T) ([]T, bool) + func AllSlice[T any](slice []T, predicate func(T) bool) bool + func AnySlice[T any](slice []T, predicate func(T) bool) bool + func AtLeast[T types.Numerical](x, lower T) T + func AtMost[T types.Numerical](x, upper T) T + func Between[T types.Numerical](x, lower, upper T) T + func Bit64ToArray(bit uint64) []uint + func BitToArrayBig(bits *big.Int) []uint + func BubbleSort(arr []int) + func CalcEntropy(m map[interface{}]int) float64 + func Clone(value interface{}, seen map[uintptr]interface{}) interface + func CloneMap[K comparable, V any](m map[K]V) map[K]V + func CompactSlice[T comparable](slice []T) []T + func ContainsAllSlice[T comparable](slice []T, items ...T) bool + func ContainsAnySlice[T comparable](slice []T, items ...T) bool + func ConvertMapKeysToString(data interface{}) interface + func CountPathSegments(path string, prefixes ...string) int + func CountSlice[T any](slice []T, predicate func(T) bool) int + func Decimals[T types.Numerical](num T, digit int) string + func DedupeValues[T any, K comparable](items []T, key func(T) (K, bool)) []K + func DeepMergeMap(target, source map[string]interface{}, options *MapMergeOptions) (map[string]interface{}, error) + func DefaultIfNilPtr[T any](param *T, defaultValue T) *T + func EqualSlices[T comparable](a, b []T) bool + func EqualUnorderedSlice[T comparable](a, b []T) bool + func FilterMap[K comparable, V any](m map[K]V, predicate func(K, V) bool) map[K]V + func FilterSliceByFunc[T any](slice []T, predicate func(T) bool) []T + func FilterSlice[T any](slice []T, predicate func(T) bool) []T + func FindLastSlice[T any](slice []T, predicate func(T) bool) (T, bool) + func FindSlice[T any](slice []T, predicate func(T) bool) (T, bool) + func FlattenMap(m map[string]interface{}, separator string) map[string]interface + func FlattenSlice[T any](slices [][]T) []T + func FormatPercentage(part, total uint64, precision int) string + func FormatRatio(ratio float64, precision int) string + func FormatRatioFromCount(part, total uint64, precision int) string + func GetBit64(min, max, step uint) uint64 + func GetBitBig(min, max, step uint) *big.Int + func GetNestedMapValue[T any](m map[string]interface{}, keys ...string) (T, bool) + func GroupSliceBy[T any, K comparable](slice []T, keyFunc func(T) K) map[K][]T + func IF[T any](condition bool, trueVal, falseVal T) T + func IfAllEmpty[T any](values []interface{}, trueVal, falseVal T) T + func IfAll[T any](conditions []bool, trueVal, falseVal T) T + func IfAllowedField[T any](field string, allowedFields []string, trueVal, falseVal T) T + func IfAny[T any](conditions []bool, trueVal, falseVal T) T + func IfBetween[T types.Numerical](val, min, max T, trueVal, falseVal T) T + func IfCEmpty[T comparable, R any](val T, trueVal, falseVal R) R + func IfCall[T any](condition bool, result T, err error, callbacks ...func(T, error)) + func IfCast[R any](val any, defaultVal R) R + func IfChain[T any](pairs []ConditionValue[T], defaultVal T) T + func IfClamp[T types.Numerical](val, min, max T) T + func IfContainsChinese[T any](str string, trueVal, falseVal T) T + func IfContains[T comparable](slice []T, target T, trueVal, falseVal T) T + func IfCountGt[R any](count, threshold int64, trueVal, falseVal R) R + func IfCount[T any](conditions []bool, threshold int, trueVal, falseVal T) T + func IfDefaultAndClamp[T types.Numerical](val, defaultVal, min, max T) T + func IfDoAF[T any](condition bool, do DoFunc[T], defaultFunc DoFunc[T]) T + func IfDoAsyncWithTimeout[T any](condition bool, do DoFunc[T], timeoutMs int, defaultVal ...T) <-chan T + func IfDoAsync[T any](condition bool, do DoFunc[T], defaultVal ...T) <-chan T + func IfDoWithErrorAsync[T any](condition bool, do DoFuncWithError[T], defaultVal T) <-chan ResultWithError[T] + func IfDoWithErrorDefault[T any](condition bool, do DoFuncWithError[T], defaultVal T) T + func IfDoWithError[T any](condition bool, do DoFuncWithError[T], defaultVal T) (T, error) + func IfDo[T any](condition bool, do DoFunc[T], defaultVal T) T + func IfElse[T any](conditions []bool, values []T, defaultVal T) T + func IfEmptyDo[T any](val T, do DoFunc[T]) T + func IfEmptySlice[T any, R any](slice []T, trueVal, falseVal R) R + func IfEmpty[T any](val T, defaultVal T) T + func IfEq[T comparable, R any](a, b T, trueVal, falseVal R) R + func IfErrOrNil[T comparable, R any](val T, err error, trueVal, falseVal R) R + func IfExec(condition bool, action func()) + func IfExecElse(condition bool, onTrue func(), onFalse ...func()) + func IfFilter[T any](useFilter bool, slice []T, predicate func(T) bool) []T + func IfGeZero[T types.Numerical](val, defaultVal T) T + func IfGe[T types.Numerical, R any](a, b T, trueVal, falseVal R) R + func IfGtZero[T types.Numerical](val, defaultVal T) T + func IfGt[T types.Numerical, R any](a, b T, trueVal, falseVal R) R + func IfHasEmpty[T any](values []interface{}, trueVal, falseVal T) T + func IfIPAllowed[T any](ip string, cidrList []string, trueVal, falseVal T) T + func IfLeZero[T types.Numerical](val, defaultVal T) T + func IfLe[T types.Numerical, R any](a, b T, trueVal, falseVal R) R + func IfLenEq[T any, R any](slice []T, length int, trueVal, falseVal R) R + func IfLenGt[T any, R any](slice []T, threshold int, trueVal, falseVal R) R + func IfLtZero[T types.Numerical](val, defaultVal T) T + func IfLt[T types.Numerical, R any](a, b T, trueVal, falseVal R) R + func IfMapElse[T, R any](condition bool, val T, trueMapper func(T) R, falseMapper ...func(T) R) R + func IfMap[T, R any](condition bool, val T, mapper func(T) R, defaultVal R) R + func IfMemoized[T any](condition bool, key string, cache map[string]T, computeFn func() T, ...) T + func IfMulti[T comparable, R any](target T, values []T, trueVal, falseVal R) R + func IfNe[T comparable, R any](a, b T, trueVal, falseVal R) R + func IfNil[T any](val interface{}, trueVal, falseVal T) T + func IfNotCEmpty[T comparable, R any](val T, trueVal, falseVal R) R + func IfNotEmpty(str string, defaultVal string) string + func IfNotEmptyValue[T any](val T, defaultVal T) T + func IfNotNilValue[T any](val interface{}, trueVal, falseVal T) T + func IfNotNil[T any](val *T, defaultVal T) T + func IfNotZero[T comparable](val T, defaultVal T) T + func IfNullOrUndefined[T any](str string, trueVal, falseVal T) T + func IfNull[T any](str string, trueVal, falseVal T) T + func IfPipeline[T any](condition bool, input T, funcs []func(T) T, defaultVal T) T + func IfSafeFieldName[T any](field string, trueVal, falseVal T) T + func IfSafeIndex[T any](slice []T, index int, defaultVal T) T + func IfSafeKey[K comparable, V any](m map[K]V, key K, defaultVal V) V + func IfStrFmt(condition bool, trueFormat string, trueArgs []any, falseFormat string, ...) (string, []any) + func IfSwitch[K comparable, V any](key K, cases map[K]V, defaultVal V) V + func IfTryParse[T, R any](input T, parser func(T) (R, error), defaultVal R) R + func IfUndefined[T any](str string, trueVal, falseVal T) T + func IfValidate[T, R any](val T, validator func(T) bool, validVal, invalidVal R) R + func IndexOfSlice[T comparable](slice []T, item T) int + func InsertionSort(arr []int) + func LastIndexOfSlice[T comparable](slice []T, item T) int + func LongestCommonPrefix(a, b string) int + func MapAssign[K comparable, V any, M ~map[K]V](maps ...M) M + func MapClone[K comparable, V any](m map[K]V) map[K]V + func MapFilterKeys[K comparable, V any](in map[K]V, predicate func(key K, value V) bool) []K + func MapFilterToSlice[K comparable, V any, R any](in map[K]V, iteratee func(key K, value V) (R, bool)) []R + func MapFilterValues[K comparable, V any](in map[K]V, predicate func(key K, value V) bool) []V + func MapFromEntries[K comparable, V any](entries []MapEntry[K, V]) map[K]V + func MapHasKey[K comparable, V any](in map[K]V, key K) bool + func MapInvert[K, V comparable](in map[K]V) map[V]K + func MapKeys[K comparable, V any](in ...map[K]V) []K + func MapMapEntries[K1 comparable, V1 any, K2 comparable, V2 any](in map[K1]V1, iteratee func(key K1, value V1) (K2, V2)) map[K2]V2 + func MapMapKeys[K comparable, V any, R comparable](in map[K]V, iteratee func(value V, key K) R) map[R]V + func MapMapValues[K comparable, V any, R any](in map[K]V, iteratee func(value V, key K) R) map[K]R + func MapOmitByKeys[K comparable, V any, M ~map[K]V](in M, keys []K) M + func MapOmitByValues[K, V comparable, M ~map[K]V](in M, values []V) M + func MapOmitBy[K comparable, V any, M ~map[K]V](in M, predicate func(key K, value V) bool) M + func MapPickByKeys[K comparable, V any, M ~map[K]V](in M, keys []K) M + func MapPickByValues[K, V comparable, M ~map[K]V](in M, values []V) M + func MapPickBy[K comparable, V any, M ~map[K]V](in M, predicate func(key K, value V) bool) M + func MapSliceByKey[T any, K comparable](slice []T, keyFunc func(T) K) map[K]T + func MapToSlice[K comparable, V any, R any](in map[K]V, iteratee func(key K, value V) R) []R + func MapUniqKeys[K comparable, V any](in ...map[K]V) []K + func MapUniqValues[K, V comparable](in ...map[K]V) []V + func MapValueOr[K comparable, V any](in map[K]V, key K, fallback V) V + func MapValues[K comparable, V any](in ...map[K]V) []V + func MarshalJSONOrDefault(value any, defaultVal string) string + func MaxSlice(values []float64) float64 + func Max[T types.Numerical](values ...T) T + func Mean(values []float64) float64 + func MergeLayeredKeyValues[T any, KV any](layers []*T, fieldGetter func(*T) []KV, keyFieldName string, ...) []KV + func MergeLayeredScalar[T any, V types.Numerical](layers []*T, fieldGetter func(*T) V) V + func MinSlice(values []float64) float64 + func Min[T types.Numerical](values ...T) T + func NoneSlice[T any](slice []T, predicate func(T) bool) bool + func ParseInt64(s string) (int64, error) + func PartitionSlice[T any](slice []T, predicate func(T) bool) (truthy, falsy []T) + func Percentage(part, total uint64) float64 + func Percentile(values []float64, p float64) float64 + func Percentiles(values []float64, percentiles ...float64) map[float64]float64 + func QuickSort(arr []int, low, high int) + func Ratio(part, total uint64) float64 + func RatioFloat(part, total float64) float64 + func RatioRound(part, total int64, precision int) float64 + func ReduceSlice[T any, R any](slice []T, initial R, accumulator func(R, T) R) R + func RemoveSliceAt[T any](slice []T, index int) []T + func RepeatField[T any](field T, count int) []T + func ReturnIfErr[T any](val T, err error) (T, error) + func ReverseSliceInPlace[T any](slice []T) + func ReverseSlice[T any](slice []T) []T + func SafeGetIndexOrDefaultNoSpace(slice []string, index int, defaultVal string) string + func SafeGetIndexOrDefault[T any](slice []T, index int, defaultVal T) (val T) + func SafeGetIndexWithErr[T any](slice []T, index int) (zero T, err error) + func SetNestedMapValue(m map[string]interface{}, value interface{}, keys ...string) + func ShallowMergeMap[K comparable, V any](maps ...map[K]V) map[K]V + func SkipLastSlice[T any](slice []T, n int) []T + func SkipSlice[T any](slice []T, n int) []T + func SliceChunk[T any](slice []T, size int) [][]T + func SliceContainsComparable[T comparable](slice []T, element T) bool + func SliceContains[T types.Ordered](slice []T, element T) bool + func SliceCountBy[T any](collection []T, predicate func(item T) bool) int + func SliceCountValuesBy[T any, U comparable](collection []T, mapper func(item T) U) map[U]int + func SliceCountValues[T comparable](collection []T) map[T]int + func SliceCut[T comparable, Slice ~[]T](collection, separator Slice) (before, after Slice, found bool) + func SliceDiffSetSorted[T types.Ordered](arr1, arr2 []T) []T + func SliceDiff[T ~[]E, E comparable](list1 T, list2 T) (ret1 T, ret2 T) + func SliceDifference[T comparable, Slice ~[]T](list1, list2 Slice) (Slice, Slice) + func SliceDropRightWhile[T any, Slice ~[]T](collection Slice, predicate func(item T) bool) Slice + func SliceDropWhile[T any, Slice ~[]T](collection Slice, predicate func(item T) bool) Slice + func SliceElementsMatch[T comparable](list1, list2 []T) bool + func SliceEqual[T comparable](a, b []T) bool + func SliceFilterMap[T, R any](collection []T, callback func(item T, index int) (R, bool)) []R + func SliceFilterToMap[T any, K comparable, V any](collection []T, transform func(item T, index int) (K, V, bool)) map[K]V + func SliceFindDuplicatesBy[T any, U comparable, Slice ~[]T](collection Slice, iteratee func(item T) U) Slice + func SliceFindDuplicates[T comparable, Slice ~[]T](collection Slice) Slice + func SliceFindUniquesBy[T any, U comparable, Slice ~[]T](collection Slice, iteratee func(item T) U) Slice + func SliceFindUniques[T comparable, Slice ~[]T](collection Slice) Slice + func SliceFirstOr[T any](collection []T, fallback T) T + func SliceFirst[T any](collection []T) (T, bool) + func SliceFisherYates[T comparable](slice []T, maxRetries int) error + func SliceFlatMap[T, R any](collection []T, iteratee func(item T, index int) []R) []R + func SliceForEachWhile[T any](collection []T, iteratee func(item T, index int) bool) + func SliceGroupByMap[T any, K comparable, V any](collection []T, iteratee func(item T) (K, V)) map[K][]V + func SliceHasDuplicates[T comparable](slice []T) bool + func SliceHasPrefix[T comparable](collection, prefix []T) bool + func SliceHasSuffix[T comparable](collection, suffix []T) bool + func SliceInterleave[T any, Slice ~[]T](collections ...Slice) Slice + func SliceIntersect[T ~[]E, E comparable](list1 T, list2 T) T + func SliceIsSortedByKey[T any, K types.Ordered](collection []T, iteratee func(item T) K) bool + func SliceIsSorted[T types.Ordered](collection []T) bool + func SliceLastOr[T any](collection []T, fallback T) T + func SliceLast[T any](collection []T) (T, bool) + func SliceMaxBy[T any](collection []T, comparison func(a, b T) bool) T + func SliceMaxIndexBy[T any](collection []T, comparison func(a, b T) bool) (T, int) + func SliceMaxOrdered[T types.Ordered](collection []T) T + func SliceMinBy[T any](collection []T, comparison func(a, b T) bool) T + func SliceMinIndexBy[T any](collection []T, comparison func(a, b T) bool) (T, int) + func SliceMinMax[T types.Numerical](list []T, f types.MinMaxFunc[T]) (T, error) + func SliceMinOrdered[T types.Ordered](collection []T) T + func SliceNthOr[T any](collection []T, nth int, fallback T) T + func SliceNth[T any](collection []T, nth int) (T, error) + func SlicePartitionBy[T any, K comparable, Slice ~[]T](collection Slice, iteratee func(item T) K) []Slice + func SliceReject[T any, Slice ~[]T](collection Slice, predicate func(item T, index int) bool) Slice + func SliceRemoveDuplicates[T comparable](numbers []T) []T + func SliceRemoveEmpty[T any](slice []T) []T + func SliceRemoveValue[T comparable, Slice ~[]T](arr Slice, value T) Slice + func SliceRemoveZero[T comparable](arr []T) []T + func SliceRemove[T any](arr []T, condition func(T) bool) []T + func SliceReplaceAll[T comparable, Slice ~[]T](collection Slice, old, nEw T) Slice + func SliceReplace[T comparable, Slice ~[]T](collection Slice, old, nEw T, n int) Slice + func SliceSubset[T any, Slice ~[]T](collection Slice, offset int, length uint) Slice + func SliceTimes[T any](count int, iteratee func(index int) T) []T + func SliceToMap[T any, K comparable](collection []T, iteratee func(item T) K) map[K]T + func SliceUnionMulti[T comparable, Slice ~[]T](lists ...Slice) Slice + func SliceUnion[T comparable](arr1, arr2 []T) []T + func SliceUniqMap[T any, R comparable](collection []T, iteratee func(item T, index int) R) []R + func SliceUniq[T ~[]E, E comparable](list T) T + func SliceWithoutBy[T any, K comparable, Slice ~[]T](collection Slice, iteratee func(item T) K, exclude ...K) Slice + func SliceWithout[T ~[]E, E comparable](list T, exclude ...E) T + func SortByCount[T any](items []T, getCount func(T) uint64) + func SortByKeyDescUnique[T any, K cmp.Ordered, ID comparable](items []T, getKey func(T) K, getID func(T) ID) []T + func SortByKeyDesc[T any, K cmp.Ordered](items []T, getKey func(T) K) + func SortByKey[T any, K cmp.Ordered](items []T, getKey func(T) K) + func StdDev(values []float64) float64 + func TakeLastSlice[T any](slice []T, n int) []T + func TakeSlice[T any](slice []T, n int) []T + func TransformAndCompactSlice[T any, R comparable](slice []T, transform func(T) R) []R + func TransformAndFilterSlice[T any, R any](slice []T, transform func(T) R, predicate func(R) bool) []R + func TransformMapKeys[K comparable, V any, R comparable](m map[K]V, transform func(K) R) map[R]V + func TransformMapValues[K comparable, V any, R any](m map[K]V, transform func(V) R) map[K]R + func TransformSlice[T any, R any](slice []T, transform func(T) R) []R + func UnflattenMap(m map[string]interface{}, separator string) map[string]interface + func UniqueSliceBy[T any, K comparable](slice []T, keyFunc func(T) K) []T + func ZeroValue[T any]() T + type ConditionValue struct + Cond bool + Value T + type DoFunc func() T + type DoFuncWithError func() (T, error) + type FilterCallback func(item *T) + type FindResult struct + func FindUpdate[T any, V any](item *T, dataMap map[string]V, getKey func(*T, ...any) string, keyArgs ...any) *FindResult[T, V] + func (r *FindResult[T, V]) Do(f func(*FindResult[T, V])) *FindResult[T, V] + func (r *FindResult[T, V]) IfFound(f func(*T, *V)) *FindResult[T, V] + func (r *FindResult[T, V]) Item() *T + func (r *FindResult[T, V]) OrElse(f func(*T)) *FindResult[T, V] + func (r *FindResult[T, V]) Stop() *FindResult[T, V] + func (r *FindResult[T, V]) Then(onFound func(*T, *V), onNotFound func(*T)) *FindResult[T, V] + func (r *FindResult[T, V]) When(cond bool, f func(*FindResult[T, V])) *FindResult[T, V] + type IFChainBuilder struct + func IFChain() *IFChainBuilder[any] + func IFChainFor[T any]() *IFChainBuilder[T] + func IFErrorChain() *IFChainBuilder[error] + func IFNilChain() *IFChainBuilder[any] + func NewIFChain[T any]() *IFChainBuilder[T] + func (c *IFChainBuilder[T]) Execute() (T, bool) + func (c *IFChainBuilder[T]) ExecuteOr(defaultValue T) T + func (c *IFChainBuilder[T]) HasResult() bool + func (c *IFChainBuilder[T]) MustExecute() T + func (c *IFChainBuilder[T]) When(condition bool) *IFChainBuilderCondition[T] + type IFChainBuilderAction struct + func (c *IFChainBuilderAction[T]) ContinueChain() *IFChainBuilder[T] + func (c *IFChainBuilderAction[T]) Return(value T) *IFChainBuilder[T] + func (c *IFChainBuilderAction[T]) ReturnNil() *IFChainBuilder[T] + type IFChainBuilderCondition struct + func (c *IFChainBuilderCondition[T]) Then(action func()) *IFChainBuilderAction[T] + func (c *IFChainBuilderCondition[T]) ThenReturn(value T, action ...func()) *IFChainBuilder[T] + func (c *IFChainBuilderCondition[T]) ThenReturnNil(action ...func()) *IFChainBuilder[T] + type IfChainer struct + func When(condition bool) *IfChainer + func (ic *IfChainer) Do() + func (ic *IfChainer) Else(action func()) *IfChainer + func (ic *IfChainer) Then(action func()) *IfChainer + type IfValueChainer struct + func WhenValue[T any](condition bool) *IfValueChainer[T] + func (ic *IfValueChainer[T]) ElseDo(fn func() T) *IfValueChainer[T] + func (ic *IfValueChainer[T]) ElseReturn(val T) *IfValueChainer[T] + func (ic *IfValueChainer[T]) Get() T + func (ic *IfValueChainer[T]) ThenDo(fn func() T) *IfValueChainer[T] + func (ic *IfValueChainer[T]) ThenReturn(val T) *IfValueChainer[T] + type LayeredMerger struct + func NewLayeredMerger[T any, KV any](keyFieldName, valueFieldName string) *LayeredMerger[T, KV] + func (m *LayeredMerger[T, KV]) Merge(layers []*T, fieldGetter func(*T) []KV) []KV + type MapEntry struct + Key K + Value V + func MapEntries[K comparable, V any](in map[K]V) []MapEntry[K, V] + type MapMergeOptions struct + MaxDepth int + OnConflict func(key string, target, source interface{}) interface{} + Strategy MapMergeStrategy + TypeStrict bool + type MapMergeStrategy int + const MapMergeStrategyError + const MapMergeStrategyKeepExisting + const MapMergeStrategyOverwrite + type Predicate func(item T) bool + type Proba struct + func NewProba() *Proba + func (p *Proba) TrueOnProba(proba float64) bool + type ResultWithError struct + Err error + Result T + type SliceChain struct + func FromSlice[T comparable](slice []T) *SliceChain[T] + func (sc *SliceChain[T]) Append(elements ...T) *SliceChain[T] + func (sc *SliceChain[T]) Data() []T + func (sc *SliceChain[T]) Filter(f func(T) bool) *SliceChain[T] + func (sc *SliceChain[T]) RemoveEmpty() *SliceChain[T] + func (sc *SliceChain[T]) RemoveValue(value T) *SliceChain[T] + func (sc *SliceChain[T]) Sort(less func(a, b T) bool) *SliceChain[T] + func (sc *SliceChain[T]) String() string + func (sc *SliceChain[T]) Uniq() *SliceChain[T] + type SliceFilter struct + func NewSliceFilter[T any](slice []T) *SliceFilter[T] + func (f *SliceFilter[T]) Condition(preds ...Predicate[T]) *SliceFilter[T] + func (f *SliceFilter[T]) OnMatch(cb FilterCallback[T]) *SliceFilter[T] + func (f *SliceFilter[T]) OnNotMatch(cb FilterCallback[T]) *SliceFilter[T] + func (f *SliceFilter[T]) Result() []T + func (f *SliceFilter[T]) UseAnd() *SliceFilter[T] + func (f *SliceFilter[T]) UseCustom(combine func([]bool) bool) *SliceFilter[T] + func (f *SliceFilter[T]) UseOr() *SliceFilter[T] + type StatsSummary struct + Count int + Max float64 + Mean float64 + Min float64 + P50 float64 + P90 float64 + P95 float64 + P99 float64 + StdDev float64 + func SummarizeStats(values []float64) StatsSummary + type Unstable struct + func NewUnstable(deviation float64) Unstable + func (u Unstable) AroundDuration(base time.Duration) time.Duration + func (u Unstable) AroundInt(base int64) int64