maps

package
v0.0.0-...-608ba51 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2024 License: MIT Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Keys

func Keys[K comparable, V any]() comb.Comb[map[K]V, []K]

Keys returns a Comb that extracts the keys of a map and returns them as a slice.

func Pairs

func Pairs[K comparable, V any]() comb.Comb[map[K]V, []*Pair[K, V]]

Pairs returns a Comb that extracts the keys and values of a map and returns them as a slice of typed pairs

func SortedKeys

func SortedKeys[K cmp.Ordered, V any]() comb.Comb[map[K]V, []K]

SortedKeys returns a Comb that extracts the keys of a map and returns them as a sorted slice.

func SortedKeysFunc

func SortedKeysFunc[K comparable, V any](
	fn slices.Compare[K],
) comb.Comb[map[K]V, []K]

SortedKeysFunc returns a Comb that extracts the keys of a map and returns them as a sorted slice using a custom comparison function.

func SortedValues

func SortedValues[K comparable, V cmp.Ordered]() comb.Comb[map[K]V, []V]

SortedValues returns a Comb that extracts the values of a map and returns them as a sorted slice.

func SortedValuesFunc

func SortedValuesFunc[K comparable, V any](
	fn slices.Compare[V],
) comb.Comb[map[K]V, []V]

SortedValuesFunc returns a Comb that extracts the values of a map and returns them as a sorted slice using a custom comparison function.

func Values

func Values[K comparable, V any]() comb.Comb[map[K]V, []V]

Values returns a Comb that extracts the values of a map and returns them as a slice.

Types

type Pair

type Pair[K comparable, V any] struct {
	Key   K
	Value V
}

Jump to

Keyboard shortcuts

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