slicez

package
v1.48.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 9, 2025 License: Apache-2.0 Imports: 2 Imported by: 2

Documentation

Index

Constants

View Source
const DefaultChunkSize = 100

Variables

This section is empty.

Functions

func Filter added in v1.45.0

func Filter[T any, Slice ~[]T](xs Slice, pred func(T) bool) Slice

Filter iterates over elements of a slice, returning a new slice with all elements that the predicate returns truthy for.

func ForEachChunk

func ForEachChunk[T any](data []T, chunkSize uint16, handler func(items []T))

ForEachChunk executes the given handler for each chunk of items in the slice.

func ForEachChunkUntil

func ForEachChunkUntil[T any](data []T, chunkSize uint16, f func([]T) (bool, error)) (bool, error)

func Map added in v1.45.0

func Map[T any, R any](xs []T, fn func(T) R) []R

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL