Documentation
¶
Index ¶
- func Filter[T any](s []T, f func(T) bool) []T
- func FilterError[T any](s []T, f func(T) (bool, error)) ([]T, error)
- func Map[T1, T2 any](s []T1, f func(T1) T2) []T2
- func MapError[T1, T2 any](s []T1, f func(T1) (T2, error)) ([]T2, error)
- func MapKeysToSlice[K comparable, V any](m map[K]V) []K
- func MapKeysToSortedSlice[M ~map[K]V, K cmp.Ordered, V any](m M) []K
- func ToStructMap[T comparable](s []T) map[T]struct{}
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FilterError ¶
FilterError filters the slice to only the values where f returns true.
Returns error the first time f returns error.
func MapKeysToSlice ¶
func MapKeysToSlice[K comparable, V any](m map[K]V) []K
MapKeysToSlice converts the map's keys to a slice.
func MapKeysToSortedSlice ¶
MapKeysToSortedSlice converts the map's keys to a sorted slice.
func ToStructMap ¶
func ToStructMap[T comparable](s []T) map[T]struct{}
ToStructMap converts the slice to a map with struct{} values.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.