maps

package module
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2022 License: MIT Imports: 1 Imported by: 1

README

maps is a utility library for go maps

In current form the lib is incredibly small. I may build it up over time.

If you need a sorted map and require performance, consider a btree.

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Merge added in v0.0.4

func Merge[K comparable, V any](m ...map[K]V) map[K]V

func SortKeys

func SortKeys[K Ordered, V any](m map[K]V) []K

SortKeys sorts the keys of a map.

Types

type KeyValue added in v0.0.3

type KeyValue[K Ordered, V any] struct {
	Key   K
	Value V
}

KeyValue is a Key Value pair.

type KeyValues added in v0.0.4

type KeyValues[K Ordered, V any] []KeyValue[K, V]

func SortByKeys

func SortByKeys[K Ordered, V any](m map[K]V) KeyValues[K, V]

Sort sorts a map by key, returning a slice of KV structs.

type Ordered added in v0.0.2

type Ordered interface {
	~int | ~int8 | ~int16 | ~int32 | ~int64 | ~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~float32 | ~float64 | ~string
}

Jump to

Keyboard shortcuts

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