maps

package
v0.0.63 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContainsAllKeys added in v0.0.62

func ContainsAllKeys[K comparable, V any, M ~map[K]V](m M, keys []K) bool

ContainsAllKeys checks whether all given keys exist in the target map.

func ContainsAnyKey added in v0.0.62

func ContainsAnyKey[K comparable, V any, M ~map[K]V](m M, keys []K) bool

ContainsAnyKey checks whether at least one of the given keys exists in the target map.

func KeyVals

func KeyVals[K comparable, V any, M ~map[K]V](m M) ([]K, []V)

KeyVals returns the keys and values from a map in indeterminate order.

func Keys

func Keys[K comparable, V any, M ~map[K]V](m M) []K

Keys returns the all keys of a map. The keys returned are in indeterminate order. As of Go 1.23, you can also use standard library https://pkg.go.dev/maps#Keys.

func Merge added in v0.0.61

func Merge[K comparable, V any, M ~map[K]V](ms ...M) map[K]V

Merge merges multiple maps into a new map.

func SortedKeys

func SortedKeys[K cmp.Ordered, V any, M ~map[K]V](m M) []K

SortedKeys returns the keys from a map in ascending order.

func SortedVals

func SortedVals[K comparable, V cmp.Ordered, M ~map[K]V](m M) []V

SortedVals returns the values from a map in ascending order.

func Vals

func Vals[K comparable, V any, M ~map[K]V](m M) []V

Vals returns a slice of all the values in m. The values returned are in indeterminate order. As of Go 1.23, you can also use standard library https://pkg.go.dev/maps#Values.

Types

This section is empty.

Jump to

Keyboard shortcuts

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