utils

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FlatMap added in v0.13.0

func FlatMap[IN any, OUT any](
	inArr []IN,
	onEachElem func(in IN) []OUT,
) []OUT

FlatMap Use for transformations that take an input array and return an output array by performing the same action on every input element. This action can be simple filtering or complete transformation into another type. Every input element can produce any number of output elements (including 0) and ordering is not kept.

func FlatMapChan added in v0.13.0

func FlatMapChan[IN any, OUT any](
	inArr []IN,
	onEachElem func(in IN, outChan chan<- OUT),
) []OUT

FlatMapChan See FlatMap, but the action performed on each element sends its output onto an open channel. Prefer this variant if said channel is being written to by other goroutines.

func SortAndDeduplicate

func SortAndDeduplicate[S ~[]E, E cmp.Ordered](s S) S

Types

This section is empty.

Jump to

Keyboard shortcuts

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