slices

package
v0.209.3 Latest Latest
Warning

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

Go to latest
Published: May 11, 2024 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendOrReplace

func AppendOrReplace[T any](slice []T, value T, fn func(T) bool) []T

AppendOrReplace appends a value to a slice if the slice does not contain a value for which the given function returns true. If the slice does contain such a value, it is replaced.

func Filter

func Filter[T any](slice []T, fn func(T) bool) []T

func Find added in v0.184.2

func Find[T any](slice []T, fn func(T) bool) (T, bool)

func FlatMap

func FlatMap[T, U any](slice []T, fn func(T) []U) []U

func GroupBy

func GroupBy[T any, K comparable](slice []T, fn func(T) K) map[K][]T

GroupBy groups the elements of a slice by the result of a function.

func Map

func Map[T, U any](slice []T, fn func(T) U) []U

func MapErr

func MapErr[T, U any](slice []T, fn func(T) (U, error)) ([]U, error)

func Reduce

func Reduce[T, U any](slice []T, initial U, fn func(U, T) U) U

Types

This section is empty.

Jump to

Keyboard shortcuts

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