Documentation
¶
Index ¶
- func Apply[T any](items []T, f func(T))
- func CompareArrays[T comparable](a, b []T) (bool, int)
- func Contains[T any](items []T, f func(T) bool) bool
- func ContainsElement[T comparable](elements []T, element T) bool
- func Copy[T any](items []T) []T
- func CopyMap[K comparable, V any](m map[K]V) map[K]V
- func Count[T comparable](items []T, value T) int
- func CountAny[T any](items []T, f func(T) bool) int
- func DoesMapContain[K comparable, V any](m map[K]V, f func(K, V) bool) bool
- func DoesMapNotContain[K comparable, V any](m map[K]V, f func(K, V) bool) bool
- func DoesNotContain[T any](items []T, f func(T) bool) bool
- func DropFirstElement[T any](elements []T) []T
- func DropFromLeft[T any](elements []T, n int) []T
- func DropFromRight[T any](elements []T, n int) []T
- func DropLastElement[T any](elements []T) []T
- func Factorial(number int) int
- func FillArray[T any](value T, numElements int) []T
- func Filter[V any](values []V, condition func(V) bool) []V
- func FilterMap[K comparable, V any](m map[K]V, condition func(K, V) bool) map[K]V
- func Find[T any](items []T, f func(T) bool) *T
- func FindInMap[K comparable, V any](m map[K]V, f func(K, V) bool, defaultKey K, defaultValue V) (K, V, bool)
- func FindIndex[T any](items []T, f func(T) bool) int
- func FindKey[K comparable, V any](m map[K]V, f func(K, V) bool, defaultValue K) (K, bool)
- func FindLast[T any](items []T, f func(T) bool) *T
- func FindLastIndex[T any](items []T, f func(T) bool) int
- func FindPointer[T any](items []*T, f func(*T) bool) *T
- func FindValue[K comparable, V any](m map[K]V, f func(K, V) bool, defaultValue V) (V, bool)
- func FlatMap[T any, O any](items []T, f func(T) []O) []O
- func FlatMapParallel[T any, O any](items []T, f func(T) ([]O, error)) ([]O, error)
- func Flatten[T any](items [][]T) []T
- func Fold[T any, O any](items []T, initial O, f func(O, T) O) O
- func ForEach[T any](items []T, f func(T))
- func GenerateRandomString(str string) string
- func GenerateUniqueHash() string
- func GenerateUniquePermutations(numTrue, numFalse int) [][]bool
- func GetFirst[T any](items []T) T
- func GetKeys[K comparable, V any](m map[K]V) []K
- func GetLast[T any](items []T) T
- func GetSecondFromLast[T any](items []T) T
- func GetShuffledCopy[T any](items []T) []T
- func GetValues[K comparable, V any](m map[K]V) []V
- func HasUniqueElements[T comparable](items []T) bool
- func InsertAtIndex[T any](items []T, index int, value T) []T
- func IsRunningInContainer() bool
- func Map[T any, O any](items []T, f func(T) O) []O
- func MapEntries[K comparable, V any, O any](m map[K]V, f func(K, V) O) []O
- func MapParallel[T any, O any](items []T, f func(T) (O, error)) ([]O, error)
- func MapToArray[K comparable, V any, O any](m map[K]V, f func(K, V) O) []O
- func MapToMap[K comparable, V any, O any](m map[K]V, f func(K, V) O) map[K]O
- func MapToPointerArray[K comparable, V any, O any](m map[K]V, f func(K, V) *O) []*O
- func Max[T constraints.Ordered](a, b T) T
- func MaxOver[T cmp.Ordered](items []T) T
- func MaxValue(values []int) int
- func Mean[T Number](values []T) float64
- func Min[T constraints.Ordered](a, b T) T
- func MinOver[T cmp.Ordered](items []T) T
- func NewIntArray(start, end int) []int
- func ParallelContains[T any](items []T, f func(T) bool) bool
- func ParallelFind[T any](items []T, f func(T) bool) *T
- func RandomElement[T any](elements []T) (element T)
- func RandomSubset[T any](array []T, size int) []T
- func Remove[T any](items []T, condition func(T) bool) []T
- func RemoveDuplicates[T comparable](items []T) []T
- func RemoveElement[T comparable](items []T, element T) []T
- func RemoveIndex[T any](items []T, index int) []T
- func Reverse[T any](items []T) []T
- func Shuffle[T any](items []T)
- func Sort[T any](items []T, less func(T, T) bool)
- func SortOrdered[T cmp.Ordered](items []T)
- func Sum[T Number](values []T) T
- func Swap[T any](items []T, i, j int)
- func Unless[T any](items []T, f func(T) bool) bool
- type Number
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CompareArrays ¶
func CompareArrays[T comparable](a, b []T) (bool, int)
func ContainsElement ¶
func ContainsElement[T comparable](elements []T, element T) bool
func CopyMap ¶
func CopyMap[K comparable, V any](m map[K]V) map[K]V
func Count ¶
func Count[T comparable](items []T, value T) int
func DoesMapContain ¶
func DoesMapContain[K comparable, V any](m map[K]V, f func(K, V) bool) bool
func DoesMapNotContain ¶
func DoesMapNotContain[K comparable, V any](m map[K]V, f func(K, V) bool) bool
func DoesNotContain ¶
func DropFirstElement ¶
func DropFirstElement[T any](elements []T) []T
func DropFromLeft ¶
func DropFromRight ¶
func DropLastElement ¶
func DropLastElement[T any](elements []T) []T
func FilterMap ¶
func FilterMap[K comparable, V any](m map[K]V, condition func(K, V) bool) map[K]V
func FindInMap ¶
func FindInMap[K comparable, V any](m map[K]V, f func(K, V) bool, defaultKey K, defaultValue V) (K, V, bool)
func FindKey ¶
func FindKey[K comparable, V any](m map[K]V, f func(K, V) bool, defaultValue K) (K, bool)
func FindLastIndex ¶
func FindPointer ¶
func FindValue ¶
func FindValue[K comparable, V any](m map[K]V, f func(K, V) bool, defaultValue V) (V, bool)
func FlatMapParallel ¶
func GenerateRandomString ¶
func GenerateUniqueHash ¶
func GenerateUniqueHash() string
func GenerateUniquePermutations ¶
Function to generate all unique permutations of an array with numTrue true values and numFalse false values
func GetKeys ¶
func GetKeys[K comparable, V any](m map[K]V) []K
func GetSecondFromLast ¶
func GetSecondFromLast[T any](items []T) T
func GetShuffledCopy ¶
func GetShuffledCopy[T any](items []T) []T
func GetValues ¶
func GetValues[K comparable, V any](m map[K]V) []V
func HasUniqueElements ¶
func HasUniqueElements[T comparable](items []T) bool
func InsertAtIndex ¶
func IsRunningInContainer ¶
func IsRunningInContainer() bool
ref: https://www.thorsten-hans.com/check-if-application-is-running-in-docker-container/
func MapEntries ¶
func MapEntries[K comparable, V any, O any](m map[K]V, f func(K, V) O) []O
func MapToArray ¶
func MapToArray[K comparable, V any, O any](m map[K]V, f func(K, V) O) []O
func MapToMap ¶
func MapToMap[K comparable, V any, O any](m map[K]V, f func(K, V) O) map[K]O
func MapToPointerArray ¶
func MapToPointerArray[K comparable, V any, O any](m map[K]V, f func(K, V) *O) []*O
func Max ¶
func Max[T constraints.Ordered](a, b T) T
func Min ¶
func Min[T constraints.Ordered](a, b T) T
func NewIntArray ¶
func ParallelContains ¶
func ParallelFind ¶
func RandomElement ¶
func RandomElement[T any](elements []T) (element T)
func RandomSubset ¶
func RemoveDuplicates ¶
func RemoveDuplicates[T comparable](items []T) []T
func RemoveElement ¶
func RemoveElement[T comparable](items []T, element T) []T
func RemoveIndex ¶
func SortOrdered ¶
Types ¶
Click to show internal directories.
Click to hide internal directories.