Documentation ¶
Overview ¶
Code generated by go generate; DO NOT EDIT.
Index ¶
- func Any[K comparable, V any](collection map[K]V, optDefaultValue ...V) (anyValue V)
- func Batch(callbacks ...func()) func()
- func Bind[FirstParamType, ParamType, ReturnType any](secondParam ParamType, callback func(FirstParamType, ParamType) ReturnType) func(FirstParamType) ReturnType
- func Comparator[T constraints.Ordered](a, b T) int
- func Compare[A constraints.Ordered](a, b A) int
- func Cond[T any](condition bool, trueValue, falseValue T) T
- func CopySlice[T any](base []T) (copied []T)
- func Filter[V any](collection []V, predicate func(V) bool) []V
- func FilterByValue[K comparable, V any](collection map[K]V, predicate func(V) bool) map[K]V
- func First[T any](slice []T, optDefaultValue ...T) (firstElement T)
- func ForEach[T any](collection []T, iteratee func(T))
- func KeyBy[K comparable, V any](collection []V, iteratee func(V) K) map[K]V
- func KeyOnlyBy[K comparable, V any](collection []V, iteratee func(V) K) map[K]struct{}
- func Keys[K comparable, V any](in map[K]V) []K
- func Map[SourceType any, TargetType any](source []SourceType, mapper func(SourceType) TargetType) (target []TargetType)
- func Max[T constraints.Ordered](collection ...T) T
- func MergeMaps[K comparable, V any](base, update map[K]V) map[K]V
- func Min[T constraints.Ordered](collection ...T) T
- func NoVariadic[V, R any](f func(...V) R) func() R
- func NoVariadic1[T1, V, R any](f func(T1, ...V) R) func(T1) R
- func NoVariadic2[T1, T2, V, R any](f func(T1, T2, ...V) R) func(T1, T2) R
- func NoVariadic3[T1, T2, T3, V, R any](f func(T1, T2, T3, ...V) R) func(T1, T2, T3) R
- func NoVariadic4[T1, T2, T3, T4, V, R any](f func(T1, T2, T3, T4, ...V) R) func(T1, T2, T3, T4) R
- func NoVariadic5[T1, T2, T3, T4, T5, V, R any](f func(T1, T2, T3, T4, T5, ...V) R) func(T1, T2, T3, T4, T5) R
- func NoVariadic6[T1, T2, T3, T4, T5, T6, V, R any](f func(T1, T2, T3, T4, T5, T6, ...V) R) func(T1, T2, T3, T4, T5, T6) R
- func NoVariadic7[T1, T2, T3, T4, T5, T6, T7, V, R any](f func(T1, T2, T3, T4, T5, T6, T7, ...V) R) func(T1, T2, T3, T4, T5, T6, T7) R
- func NoVariadic8[T1, T2, T3, T4, T5, T6, T7, T8, V, R any](f func(T1, T2, T3, T4, T5, T6, T7, T8, ...V) R) func(T1, T2, T3, T4, T5, T6, T7, T8) R
- func NoVariadic9[T1, T2, T3, T4, T5, T6, T7, T8, T9, V, R any](f func(T1, T2, T3, T4, T5, T6, T7, T8, T9, ...V) R) func(T1, T2, T3, T4, T5, T6, T7, T8, T9) R
- func PanicOnErr[T any](result T, err error) T
- func Reduce[T any, R any](collection []T, accumulator func(R, T) R, initial R) R
- func ReduceProperty[A, B, C any](collection []A, propertyResolver func(A) B, accumulator func(C, B) C, ...) C
- func Return1[A any](a A, _ ...any) A
- func Return2[A any](_ any, a A, _ ...any) A
- func Return3[A any](_, _ any, a A, _ ...any) A
- func Return4[A any](_, _, _ any, a A, _ ...any) A
- func Return5[A any](_, _, _, _ any, a A, _ ...any) A
- func Sum[T constraints.Numeric](collection ...T) T
- func Values[K comparable, V any](in map[K]V) []V
- func Void[A, B any](f func(A) B) func(A)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Any ¶
func Any[K comparable, V any](collection map[K]V, optDefaultValue ...V) (anyValue V)
Any returns the first element of the map or an optionally provided default value if the collection is empty (if no default value is provided, the zero value of the collection's element type is returned).
func Bind ¶
func Bind[FirstParamType, ParamType, ReturnType any](secondParam ParamType, callback func(FirstParamType, ParamType) ReturnType) func(FirstParamType) ReturnType
Bind generates a call wrapper with the second parameter's value fixed.
func Comparator ¶
func Comparator[T constraints.Ordered](a, b T) int
Comparator is a generic comparator for two values. It returns 0 if the two values are equal, -1 if the first value is smaller and 1 if the first value is larger.
func Compare ¶
func Compare[A constraints.Ordered](a, b A) int
Compare returns -1, 0 or 1 if the first parameter is smaller, equal or greater than the second argument.
func Cond ¶
Cond is a conditional statement that returns the trueValue if the condition is true and the falseValue otherwise.
func CopySlice ¶
func CopySlice[T any](base []T) (copied []T)
CopySlice copies the base slice into copied and returns the copy.
func Filter ¶
Filter iterates over elements of collection, returning an array of all elements predicate returns truthy for.
func FilterByValue ¶
func FilterByValue[K comparable, V any](collection map[K]V, predicate func(V) bool) map[K]V
FilterByValue iterates over the map, returning a map of all elements predicate returns truthy for.
func First ¶
func First[T any](slice []T, optDefaultValue ...T) (firstElement T)
First returns the first element of the slice or an optionally provided default value if the collection is empty (if no default value is provided, the zero value of the collection's element type is returned).
func ForEach ¶
func ForEach[T any](collection []T, iteratee func(T))
ForEach iterates over elements of collection and invokes iteratee for each element.
func KeyBy ¶
func KeyBy[K comparable, V any](collection []V, iteratee func(V) K) map[K]V
KeyBy transforms a slice or an array of structs to a map based on a pivot callback.
func KeyOnlyBy ¶
func KeyOnlyBy[K comparable, V any](collection []V, iteratee func(V) K) map[K]struct{}
KeyOnlyBy transforms a slice or an array of structs to a map containing the keys based on a pivot callback.
func Map ¶
func Map[SourceType any, TargetType any](source []SourceType, mapper func(SourceType) TargetType) (target []TargetType)
Map iterates over elements of collection, applies the mapper function to each element and returns an array of modified TargetType elements.
func Max ¶
func Max[T constraints.Ordered](collection ...T) T
Max returns the maximum value of the collection.
func MergeMaps ¶
func MergeMaps[K comparable, V any](base, update map[K]V) map[K]V
MergeMaps updates the base map with values from the update map and returns the extended base map.
func Min ¶
func Min[T constraints.Ordered](collection ...T) T
Min returns the minimum value of the collection.
func NoVariadic ¶
func NoVariadic[V, R any](f func(...V) R) func() R
NoVariadic turns a variadic function into a non-variadic one (variadic part empty).
func NoVariadic1 ¶
func NoVariadic1[T1, V, R any](f func(T1, ...V) R) func(T1) R
NoVariadic1 turns a variadic function with 1 additional parameters into a non-variadic one (variadic part empty).
func NoVariadic2 ¶
func NoVariadic2[T1, T2, V, R any](f func(T1, T2, ...V) R) func(T1, T2) R
NoVariadic2 turns a variadic function with 2 additional parameters into a non-variadic one (variadic part empty).
func NoVariadic3 ¶
func NoVariadic3[T1, T2, T3, V, R any](f func(T1, T2, T3, ...V) R) func(T1, T2, T3) R
NoVariadic3 turns a variadic function with 3 additional parameters into a non-variadic one (variadic part empty).
func NoVariadic4 ¶
func NoVariadic4[T1, T2, T3, T4, V, R any](f func(T1, T2, T3, T4, ...V) R) func(T1, T2, T3, T4) R
NoVariadic4 turns a variadic function with 4 additional parameters into a non-variadic one (variadic part empty).
func NoVariadic5 ¶
func NoVariadic5[T1, T2, T3, T4, T5, V, R any](f func(T1, T2, T3, T4, T5, ...V) R) func(T1, T2, T3, T4, T5) R
NoVariadic5 turns a variadic function with 5 additional parameters into a non-variadic one (variadic part empty).
func NoVariadic6 ¶
func NoVariadic6[T1, T2, T3, T4, T5, T6, V, R any](f func(T1, T2, T3, T4, T5, T6, ...V) R) func(T1, T2, T3, T4, T5, T6) R
NoVariadic6 turns a variadic function with 6 additional parameters into a non-variadic one (variadic part empty).
func NoVariadic7 ¶
func NoVariadic7[T1, T2, T3, T4, T5, T6, T7, V, R any](f func(T1, T2, T3, T4, T5, T6, T7, ...V) R) func(T1, T2, T3, T4, T5, T6, T7) R
NoVariadic7 turns a variadic function with 7 additional parameters into a non-variadic one (variadic part empty).
func NoVariadic8 ¶
func NoVariadic8[T1, T2, T3, T4, T5, T6, T7, T8, V, R any](f func(T1, T2, T3, T4, T5, T6, T7, T8, ...V) R) func(T1, T2, T3, T4, T5, T6, T7, T8) R
NoVariadic8 turns a variadic function with 8 additional parameters into a non-variadic one (variadic part empty).
func NoVariadic9 ¶
func NoVariadic9[T1, T2, T3, T4, T5, T6, T7, T8, T9, V, R any](f func(T1, T2, T3, T4, T5, T6, T7, T8, T9, ...V) R) func(T1, T2, T3, T4, T5, T6, T7, T8, T9) R
NoVariadic9 turns a variadic function with 9 additional parameters into a non-variadic one (variadic part empty).
func PanicOnErr ¶
PanicOnErr panics of the seconds parameter is an error and returns the first parameter otherwise.
func Reduce ¶
Reduce reduces collection to a value which is the accumulated result of running each element in collection through accumulator, where each successive invocation is supplied the return value of the previous.
func ReduceProperty ¶
func ReduceProperty[A, B, C any](collection []A, propertyResolver func(A) B, accumulator func(C, B) C, initial C) C
ReduceProperty reduces collection to a value which is the accumulated result of running each element in collection through property resolver, which extracts a value to be reduced from the type, and then accumulator, where each successive invocation is supplied the return value of the previous.
func Sum ¶
func Sum[T constraints.Numeric](collection ...T) T
Sum returns the sum of the collection.
func Values ¶
func Values[K comparable, V any](in map[K]V) []V
Values creates an array of the map values.
Types ¶
This section is empty.