Documentation
¶
Index ¶
- func Backward[E any](s []E) func(func(int, E) bool)
- func Batch[T any](ctx context.Context, elems []T, size int, fn func(context.Context, []T) error) error
- func Chunks[T any](items []T, chunkSize int) [][]T
- func Concat[T any](slices ...[]T) []T
- func Deduplicate[T comparable](slice []T) []T
- func UniqueCopy[T comparable](slice []T) []T
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Batch ¶ added in v0.0.22
func Batch[T any](ctx context.Context, elems []T, size int, fn func(context.Context, []T) error) error
Batch applies fn to successive chunks of at most "size" elements. A size of 0 (or negative) processes all the elements in one chunk. Stops at the first error and returns it.
func Concat ¶ added in v0.0.5
func Concat[T any](slices ...[]T) []T
Concat concatenates multiple slices and returns the result.
func Deduplicate ¶ added in v0.0.8
func Deduplicate[T comparable](slice []T) []T
Deduplicate filters a slice of any comparable type, removing duplicate elements in place. Keeps the order of the original slice. The original slice can't be used after calling this function because it's likely to have a different length.
func UniqueCopy ¶ added in v0.0.8
func UniqueCopy[T comparable](slice []T) []T
UniqueCopy filters a slice of any comparable type, returning a slice of unique elements. Keeps the order of the original slice.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.