# Packages
# README
genericz - convenience made possible since generics
The main package only contains Min(a ...T) T
, Max(a ...T) T
and Ternary(cond bool, a, b T) T
.
The packages below are intended to contain additions to golang.org/x/exp/slices and golang.org/x/exp/maps and thus won't be the full set that you need. (Over time there will be overlap as we won't remove methods as it would break backwards compatibility.)
mapz
The mapz package contains:
KeysSorted(m map[K]V) []K
,ValuesSorted(m map[K]V) []V
andValuesSortedByKey(m map[K]V) []V
MinKey(m map[K]V) K
andMaxKey(m map[K]V) K
DeleteWithLock(l sync.Locker, m map[K]V, key K)
andStoreWithLock(l sync.Locker, m map[K]V, key K, value V)
The SyncMap
is a type-safe sync.Map
.
The MutexMap
is a variant of SyncMap
that uses a mutex and a regular map.
The AppendMap
is an append-only map perfect for caching values that never change. It slightly cheaper than a sync.Map
because values can't change.
slicez
The slicez packages contains Diff, Filter, Map, Unique, Concat and Sum.
orderedobject
The orderedobject allows you to decode a JSON dict while preserving order. Can be used with most json encoders/decoders.