package
0.0.0-20240510080100-1c003c80f533
Repository: https://github.com/nartvt/go-core.git
Documentation: pkg.go.dev

# Functions

Contains Check item in slice T type.
ContainsBy returns true if predicate function return true.
Diff Get []T in sources but not in slices Example: slices.Diff(skus, products, func(p Product) string { return p.TkSku }).
Every returns true if all elements of a subset are contained into a collection or if the subset is empty.
EveryBy returns true if the predicate returns true for all of the elements in the collection or if the collection is empty.
Filter iterating over elements of a collection, returning an array of all elements predicate returns truthy for.
FilterIndex Filter with predicate index Filter handle index.
FilterMap returns a slice which obtained after both filtering and mapping using the given callback function.
First iterates over elements of collection, returning first element returns truthy for.
FlatMap manipulates a slice and transforms and flattens it to a slice of another type.
FlatMapIndex manipulates a slice and transforms and flattens it to a slice of another type.
Flatten returns an array a single level deep.
ForEach iterates over elements of collection and invokes iteratee for each element.
ForEachIndex iterates over elements of collection and invokes iteratee for each element.
GetAt get element at pos of slices.
GroupBy returns an object composed of keys generated from the results of running each element of collection through iteratee.
GroupFlatMapBy returns an object composed of keys generated from the results of running each element of collection through iteratee.
GroupMapBy returns an object composed of keys generated from the results of running each element of collection through iteratee.
IsEmpty check slices are empty.
IsNotEmpty check slices are not empty.
Key transforms a slice or an array of structs to a map based on a pivot callback Example: slices.Key(products, func(p Product) int64 { return p.ID }).
KeyBy transforms a slice or an array of structs to a map based on a pivot callback Example: slices.KeyBy(products, func(p Product) (int64, string) { return p.ID, p.TkSku }).
No description provided by the author
Map Convert []U to []V with func transform Example: slices.Map(products, func(p Product) []int64 { return p.ID }).
MapDistinct Map and DISTINCT.
MapIndex Convert []U to []V with func transform Map handle index Example: slices.Map2(products, func(p Product, index int) []int64 { return p.ID }).
Max searches the maximum value of a collection.
MaxBy search the maximum value of a collection using the given comparison function.
Min search the minimum value of a collection.
MinBy search the minimum value of a collection using the given comparison function.
Nth returns the element at index `nth` of collection.
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.
ToFlatMap convert []U to map[K][]V Example: collection.MakeAndMergeMap(products, func(p Product) (int64, string) { return p.ID, p.TkSku }).
Uniq returns a duplicate-free version of an array, in which only the first occurrence of each element is kept.
UniqBy returns a duplicate-free version of an array, in which only the first occurrence of each element is kept.