Documentation
¶
Index ¶
- Constants
- func Filter[T any, Slice ~[]T](xs Slice, pred func(T) bool) Slice
- func ForEachChunk[T any](data []T, chunkSize uint16, handler func(items []T))
- func ForEachChunkUntil[T any](data []T, chunkSize uint16, f func([]T) (bool, error)) (bool, error)
- func Map[T any, R any](xs []T, fn func(T) R) []R
- func Unique[T comparable, Slice ~[]T](xs Slice) Slice
Constants ¶
View Source
const DefaultChunkSize = 100
Variables ¶
This section is empty.
Functions ¶
func Filter ¶ added in v1.45.0
Filter iterates over elements of a slice, returning a new slice with all elements that the predicate returns truthy for.
func ForEachChunk ¶
ForEachChunk executes the given handler for each chunk of items in the slice.
func ForEachChunkUntil ¶
func Map ¶ added in v1.45.0
Map iterates over a slice and creates a new slice with each element transformed.
func Unique ¶
func Unique[T comparable, Slice ~[]T](xs Slice) Slice
Unique returns a duplicate-free version of a slice, in which only the first occurrence of each element is kept.
The order of result values is determined by the order they occur.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.