slice

package
v1.13.5 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func All

func All[A any, B any](in []A, f func(A))

func Filter

func Filter[V any](slice []V, filterIn func(val V) bool) []V

func FromMapKeys

func FromMapKeys[K constraints.Ordered, V any](mm map[K]V) []K

func FromMapValues

func FromMapValues[K constraints.Ordered, V any](mm map[K]V) []V

func MakeMapKeys

func MakeMapKeys[K comparable, V any](slice []V, getKey func(V) K) map[K]V

MakeMapKeys makes a map of provided slice and a function which returns a key value for a map given an item from a slice. If key already exists, it overrides it.

func Map

func Map[A any, B any](in []A, f func(A) B) []B

func MapErr

func MapErr[A any, B any](in []A, f func(A) (B, error)) ([]B, error)

func MustMakeMapKeys added in v0.10.0

func MustMakeMapKeys[K comparable, V any](slice []V, getKey func(V) K) map[K]V

MustMakeMapKeys makes a map of provided slice and a function which returns a key value for a map given an item from a slice. If key already exists, it panics.

func Reduce

func Reduce[R any, V any](slice []V, reducer func(prev R, val V) (next R)) R

Types

This section is empty.

Jump to

Keyboard shortcuts

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