Documentation
¶
Index ¶
- func AreEqual[K comparable](map1, map2 map[K]string) bool
- func Merge[K comparable, V any](ms ...map[K]V) map[K]V
- func MergeTo[K comparable, V any](original map[K]V, ms ...map[K]V) map[K]V
- func Select[K comparable, V any](originalMap map[K]V, keys ...K) map[K]V
- type Map
- func (m *Map[K, V]) Delete(k K)
- func (m *Map[K, V]) Load(k K) (_ V, _ bool)
- func (m *Map[K, V]) LoadAndDelete(k K) (_ V, _ bool)
- func (m *Map[K, V]) LoadOrStore(k K, v V) (_ V, _ bool)
- func (m *Map[K, V]) Range(f func(K, V) bool)
- func (m *Map[K, V]) Store(k K, v V)
- func (m *Map[K, V]) Swap(k K, v V) (_ V, _ bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AreEqual ¶
func AreEqual[K comparable](map1, map2 map[K]string) bool
AreEqual checks if two maps are equal.
func Merge ¶
func Merge[K comparable, V any](ms ...map[K]V) map[K]V
Merge merges all maps to a new one.
func MergeTo ¶
func MergeTo[K comparable, V any](original map[K]V, ms ...map[K]V) map[K]V
MergeTo merges all maps to the original one.
func Select ¶
func Select[K comparable, V any](originalMap map[K]V, keys ...K) map[K]V
Select returns a new map with selected keys and values of the originalMap
Types ¶
type Map ¶
type Map[K comparable, V any] struct { sync.Map }
Map is a wrapper of sync.Map to avoid type assertion in the outer function
func (*Map[K, V]) LoadAndDelete ¶
func (*Map[K, V]) LoadOrStore ¶
Click to show internal directories.
Click to hide internal directories.