Documentation
¶
Index ¶
- func AscOrder[K constraints.Ordered](v1, v2 K) bool
- func CreateDictFromSlice[K comparable, X any, Y any](input []X, keyFunc func(*X) K, valueFunc func(*X) Y) map[K]Y
- func CreateSliceFromDict[K comparable, X any, Y any](input map[K]X, f func(K, X) Y) []Y
- func DescOrder[K constraints.Ordered](v1, v2 K) bool
- func ForEachSlice[X any](input []X, f func(int, *X) error) error
- func GetSymmetricallyDifferentKeys[K comparable, X any](a, b map[K]X) ([]K, []K)
- func GroupByToDict[K comparable, X any, Y any](input []X, keyFunc func(*X) K, valueFunc func(*X) Y) map[K][]Y
- func MapAndFilterSliceWithIndex[X any, Y any](input []X, f func(int, X) Y, filter func(int, X) bool) []Y
- func MapSlice[X any, Y any](input []X, f func(X) Y) []Y
- func MapSliceWithIndex[X any, Y any](input []X, f func(int, X) Y) []Y
- func SortSlice[K constraints.Ordered](slice []K) []K
- func SortSliceWithCmpFunc[K any](slice []K, comparisonFunc func(k1, k2 K) bool) []K
- func SplitIntoBatches[X any](input []X, batchSize int) [][]X
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AscOrder ¶
func AscOrder[K constraints.Ordered](v1, v2 K) bool
AscOrder is a comparison function for sorting in ascending order
func CreateDictFromSlice ¶
func CreateDictFromSlice[K comparable, X any, Y any](input []X, keyFunc func(*X) K, valueFunc func(*X) Y) map[K]Y
CreateDictFromSlice is a generic function for creating a hash table from a flat list
func CreateSliceFromDict ¶
func CreateSliceFromDict[K comparable, X any, Y any](input map[K]X, f func(K, X) Y) []Y
CreateSliceFromDict creates a slice from a hash table
func DescOrder ¶
func DescOrder[K constraints.Ordered](v1, v2 K) bool
DescOrder is a comparison function for sorting in descending order
func ForEachSlice ¶
ForEachSlice is a generic function for modifying elements of a slice
func GetSymmetricallyDifferentKeys ¶
func GetSymmetricallyDifferentKeys[K comparable, X any](a, b map[K]X) ([]K, []K)
GetSymmetricallyDifferentKeys returns the symmetric difference of keys of hash tables Unique keys of each hash table are returned separately
func GroupByToDict ¶
func GroupByToDict[K comparable, X any, Y any](input []X, keyFunc func(*X) K, valueFunc func(*X) Y) map[K][]Y
GroupByToDict is a generic function for grouping data into a hash table
func MapAndFilterSliceWithIndex ¶
func MapAndFilterSliceWithIndex[X any, Y any](input []X, f func(int, X) Y, filter func(int, X) bool) []Y
MapAndFilterSliceWithIndex is a generic function for filtering and transforming elements of a slice
func MapSlice ¶
MapSlice is a generic function that takes a slice of elements of type X and transforms it into a slice of elements of type Y by applying the function f to each element
func MapSliceWithIndex ¶
MapSliceWithIndex is a generic function that takes a slice of elements of type X and transforms it into a slice of elements of type Y by applying the function f to each element, including the index
func SortSlice ¶
func SortSlice[K constraints.Ordered](slice []K) []K
SortSlice is a generic function for sorting slices in ascending order
func SortSliceWithCmpFunc ¶
SortSliceWithCmpFunc is a generic function for sorting lists with customizable comparison
func SplitIntoBatches ¶ added in v0.0.3
SplitIntoBatches splits a slice into batches of a given size
Types ¶
This section is empty.