Documentation ¶
Index ¶
- func ApplyAndAggregateErrors[T any](xs []T, f func(T) error) error
- func ApplyOrFail[T any](xs []T, f func(T) error) error
- func Filter[T any](xs []T, f func(T) bool) []T
- func Fold[T any, Acc any](xs []T, f func(Acc, T) Acc, acc Acc) Acc
- func KeysOfMap[K comparable, V any](m map[K]V) []K
- func Map[T any, K any](s []T, f func(T) K) []K
- func MapIdx[V any, R any](s []V, f func(int, V) R) []R
- type Tuple
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyAndAggregateErrors ¶
ApplyAndAggregateErrors applies the provided function for each element of the slice If the function returns an error, it accumulates the error and continues execution After all elements are processed, it returns the aggregated errors if any
func ApplyOrFail ¶
ApplyOrFail tries applying the provided function for each element of the slice If the function returns an error, we break execution and return the error
func Filter ¶
Filter applies a function to each element of a slice, returning a new slice with only the elements for which the function returns true.
func Fold ¶
Fold accumulates the result of f into acc and returns acc by applying f over each element in the slice
func KeysOfMap ¶ added in v6.7.6
func KeysOfMap[K comparable, V any](m map[K]V) []K
Types ¶
type Tuple ¶ added in v6.7.4
type Tuple[T comparable] struct { First, Second T }
Click to show internal directories.
Click to hide internal directories.