maps

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2022 License: MIT Imports: 1 Imported by: 1

README

maps is a map utilities library

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 SortKeys

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

SortKeys sorts the keys of a map.

Types

type KeyVal

type KeyVal[K Ordered, V any] struct {
	Key K
	Val V
}

KeyVal is a Key Value pair.

type KeyVals

type KeyVals[K Ordered, V any] []KeyVal[K, V]

func SortByKeys

func SortByKeys[K Ordered, V any](m map[K]V) KeyVals[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