Documentation ¶
Index ¶
- type Equaler
- type Getter
- type Loader
- type Map
- func (m *Map[K, V]) Clear()
- func (m Map[K, V]) Delete(k K)
- func (m Map[K, V]) Equal(m2 MapI[K, V]) bool
- func (m Map[K, V]) Get(k K) V
- func (m Map[K, V]) Has(k K) bool
- func (m Map[K, V]) Keys() []K
- func (m Map[K, V]) Len() int
- func (m Map[K, V]) Load(k K) V
- func (m Map[K, V]) MarshalBinary() ([]byte, error)
- func (m Map[K, V]) MarshalJSON() (out []byte, err error)
- func (m *Map[K, V]) Merge(in MapI[K, V])
- func (m Map[K, V]) Range(f func(k K, v V) bool)
- func (m *Map[K, V]) Set(k K, v V)
- func (m Map[K, V]) String() string
- func (m *Map[K, V]) UnmarshalBinary(data []byte) (err error)
- func (m *Map[K, V]) UnmarshalJSON(in []byte) (err error)
- func (m Map[K, V]) Values() []V
- type MapI
- type SafeMap
- func (m *SafeMap[K, V]) Clear()
- func (m *SafeMap[K, V]) Delete(k K)
- func (m *SafeMap[K, V]) Equal(m2 MapI[K, V]) bool
- func (m *SafeMap[K, V]) Get(k K) (v V)
- func (m *SafeMap[K, V]) Has(k K) (exists bool)
- func (m *SafeMap[K, V]) Keys() (keys []K)
- func (m *SafeMap[K, V]) Len() (l int)
- func (m *SafeMap[K, V]) Load(k K) (v V)
- func (m *SafeMap[K, V]) MarshalBinary() ([]byte, error)
- func (m *SafeMap[K, V]) MarshalJSON() (out []byte, err error)
- func (m *SafeMap[K, V]) Merge(in MapI[K, V])
- func (m *SafeMap[K, V]) Range(f func(k K, v V) bool)
- func (m *SafeMap[K, V]) Set(k K, v V)
- func (m *SafeMap[K, V]) String() string
- func (m *SafeMap[K, V]) UnmarshalBinary(data []byte) (err error)
- func (m *SafeMap[K, V]) UnmarshalJSON(in []byte) (err error)
- func (m *SafeMap[K, V]) Values() (v []V)
- type SafeSliceMap
- func (m *SafeSliceMap[K, V]) Clear()
- func (m *SafeSliceMap[K, V]) Delete(key K)
- func (m *SafeSliceMap[K, V]) Equal(m2 MapI[K, V]) bool
- func (m *SafeSliceMap[K, V]) Get(key K) (val V)
- func (m *SafeSliceMap[K, V]) GetAt(position int) (val V)
- func (m *SafeSliceMap[K, V]) GetKeyAt(position int) (key K)
- func (m *SafeSliceMap[K, V]) Has(key K) (ok bool)
- func (m *SafeSliceMap[K, V]) Keys() (keys []K)
- func (m *SafeSliceMap[K, V]) Len() int
- func (m *SafeSliceMap[K, V]) Load(key K) (val V)
- func (m *SafeSliceMap[K, V]) MarshalBinary() (data []byte, err error)
- func (m *SafeSliceMap[K, V]) MarshalJSON() (data []byte, err error)
- func (m *SafeSliceMap[K, V]) Merge(in MapI[K, V])
- func (m *SafeSliceMap[K, V]) Range(f func(key K, value V) bool)
- func (m *SafeSliceMap[K, V]) Set(key K, val V)
- func (m *SafeSliceMap[K, V]) SetAt(index int, key K, val V)
- func (m *SafeSliceMap[K, V]) SetSortFunc(f func(key1, key2 K, val1, val2 V) bool)
- func (m *SafeSliceMap[K, V]) String() string
- func (m *SafeSliceMap[K, V]) UnmarshalBinary(data []byte) (err error)
- func (m *SafeSliceMap[K, V]) UnmarshalJSON(data []byte) (err error)
- func (m *SafeSliceMap[K, V]) Values() (vals []V)
- type Set
- func (m *Set[K]) Add(k ...K) SetI[K]
- func (m *Set[K]) Clear()
- func (m *Set[K]) Delete(k K)
- func (m *Set[K]) Equal(m2 SetI[K]) bool
- func (m *Set[K]) Has(k K) bool
- func (m *Set[K]) Len() int
- func (m *Set[K]) MarshalBinary() ([]byte, error)
- func (m *Set[K]) MarshalJSON() (out []byte, err error)
- func (m *Set[K]) Merge(in SetI[K])
- func (m *Set[K]) Range(f func(k K) bool)
- func (m *Set[K]) String() string
- func (m *Set[K]) UnmarshalBinary(data []byte) (err error)
- func (m *Set[K]) UnmarshalJSON(in []byte) (err error)
- func (m *Set[K]) Values() []K
- type SetI
- type Setter
- type SliceMap
- func (m *SliceMap[K, V]) Clear()
- func (m *SliceMap[K, V]) Delete(key K)
- func (m *SliceMap[K, V]) Equal(m2 MapI[K, V]) bool
- func (m *SliceMap[K, V]) Get(key K) (val V)
- func (m *SliceMap[K, V]) GetAt(position int) (val V)
- func (m *SliceMap[K, V]) GetKeyAt(position int) (key K)
- func (m *SliceMap[K, V]) Has(key K) (ok bool)
- func (m *SliceMap[K, V]) Keys() (keys []K)
- func (m *SliceMap[K, V]) Len() int
- func (m *SliceMap[K, V]) Load(key K) (val V)
- func (m *SliceMap[K, V]) MarshalBinary() (data []byte, err error)
- func (m *SliceMap[K, V]) MarshalJSON() (data []byte, err error)
- func (m *SliceMap[K, V]) Merge(in MapI[K, V])
- func (m *SliceMap[K, V]) Range(f func(key K, value V) bool)
- func (m *SliceMap[K, V]) Set(key K, val V)
- func (m *SliceMap[K, V]) SetAt(index int, key K, val V)
- func (m *SliceMap[K, V]) SetSortFunc(f func(key1, key2 K, val1, val2 V) bool)
- func (m *SliceMap[K, V]) String() string
- func (m *SliceMap[K, V]) UnmarshalBinary(data []byte) (err error)
- func (m *SliceMap[K, V]) UnmarshalJSON(data []byte) (err error)
- func (m *SliceMap[K, V]) Values() (vals []V)
- type StdMap
- func (m StdMap[K, V]) Clear()
- func (m StdMap[K, V]) Delete(k K)
- func (m StdMap[K, V]) Equal(m2 MapI[K, V]) bool
- func (m StdMap[K, V]) Get(k K) (v V)
- func (m StdMap[K, V]) Has(k K) (exists bool)
- func (m StdMap[K, V]) Keys() (keys []K)
- func (m StdMap[K, V]) Len() int
- func (m StdMap[K, V]) Load(k K) (v V)
- func (m StdMap[K, V]) MarshalBinary() ([]byte, error)
- func (m StdMap[K, V]) MarshalJSON() (out []byte, err error)
- func (m StdMap[K, V]) Merge(in MapI[K, V])
- func (m StdMap[K, V]) Range(f func(k K, v V) bool)
- func (m StdMap[K, V]) Set(k K, v V)
- func (m StdMap[K, V]) String() string
- func (m *StdMap[K, V]) UnmarshalBinary(data []byte) (err error)
- func (m *StdMap[K, V]) UnmarshalJSON(in []byte) (err error)
- func (m StdMap[K, V]) Values() (values []V)
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Getter ¶
type Getter[K comparable, V any] interface { Get(k K) (v V) }
type Loader ¶
type Loader[K comparable, V any] interface { Load(k K) (v V) }
type Map ¶
type Map[K comparable, V any] struct { // contains filtered or unexported fields }
func (Map[K, V]) MarshalBinary ¶
func (Map[K, V]) MarshalJSON ¶
func (Map[K, V]) String ¶
Example ¶
m := new(Map[string, int]) m.Set("a", 1) m.Set("b", 2) fmt.Print(m)
Output:
func (*Map[K, V]) UnmarshalBinary ¶
func (*Map[K, V]) UnmarshalJSON ¶
type SafeMap ¶
type SafeMap[K comparable, V any] struct { sync.RWMutex // contains filtered or unexported fields }
func (*SafeMap[K, V]) MarshalBinary ¶
func (*SafeMap[K, V]) MarshalJSON ¶
func (*SafeMap[K, V]) String ¶
Example ¶
m := new(SafeMap[string, int]) m.Set("a", 1) m.Set("b", 2) fmt.Print(m)
Output:
func (*SafeMap[K, V]) UnmarshalBinary ¶
func (*SafeMap[K, V]) UnmarshalJSON ¶
type SafeSliceMap ¶
type SafeSliceMap[K comparable, V any] struct { sync.RWMutex // contains filtered or unexported fields }
func (*SafeSliceMap[K, V]) Clear ¶
func (m *SafeSliceMap[K, V]) Clear()
func (*SafeSliceMap[K, V]) Delete ¶
func (m *SafeSliceMap[K, V]) Delete(key K)
func (*SafeSliceMap[K, V]) Equal ¶
func (m *SafeSliceMap[K, V]) Equal(m2 MapI[K, V]) bool
func (*SafeSliceMap[K, V]) Get ¶
func (m *SafeSliceMap[K, V]) Get(key K) (val V)
func (*SafeSliceMap[K, V]) GetAt ¶
func (m *SafeSliceMap[K, V]) GetAt(position int) (val V)
Example ¶
m := new(SafeSliceMap[string, int]) m.Set("b", 2) m.Set("c", 3) m.Set("a", 1) v := m.GetAt(1) fmt.Print(v)
Output:
func (*SafeSliceMap[K, V]) GetKeyAt ¶
func (m *SafeSliceMap[K, V]) GetKeyAt(position int) (key K)
Example ¶
m := new(SafeSliceMap[string, int]) m.Set("b", 2) m.Set("c", 3) m.Set("a", 1) v := m.GetKeyAt(1) fmt.Print(v)
Output:
func (*SafeSliceMap[K, V]) Has ¶
func (m *SafeSliceMap[K, V]) Has(key K) (ok bool)
func (*SafeSliceMap[K, V]) Keys ¶
func (m *SafeSliceMap[K, V]) Keys() (keys []K)
func (*SafeSliceMap[K, V]) Len ¶
func (m *SafeSliceMap[K, V]) Len() int
func (*SafeSliceMap[K, V]) Load ¶
func (m *SafeSliceMap[K, V]) Load(key K) (val V)
func (*SafeSliceMap[K, V]) MarshalBinary ¶
func (m *SafeSliceMap[K, V]) MarshalBinary() (data []byte, err error)
func (*SafeSliceMap[K, V]) MarshalJSON ¶
func (m *SafeSliceMap[K, V]) MarshalJSON() (data []byte, err error)
func (*SafeSliceMap[K, V]) Merge ¶
func (m *SafeSliceMap[K, V]) Merge(in MapI[K, V])
func (*SafeSliceMap[K, V]) Range ¶
func (m *SafeSliceMap[K, V]) Range(f func(key K, value V) bool)
func (*SafeSliceMap[K, V]) Set ¶
func (m *SafeSliceMap[K, V]) Set(key K, val V)
func (*SafeSliceMap[K, V]) SetAt ¶
func (m *SafeSliceMap[K, V]) SetAt(index int, key K, val V)
Example ¶
m := new(SafeSliceMap[string, int]) m.Set("b", 2) m.Set("a", 1) m.SetAt(1, "c", 3) fmt.Println(m)
Output:
func (*SafeSliceMap[K, V]) SetSortFunc ¶
func (m *SafeSliceMap[K, V]) SetSortFunc(f func(key1, key2 K, val1, val2 V) bool)
Example ¶
m := new(SafeSliceMap[string, int]) m.Set("b", 2) m.Set("a", 1) fmt.Println(m) m.SetSortFunc(func(k1, k2 string, v1, v2 int) bool { return k1 < k2 }) fmt.Println(m)
Output:
func (*SafeSliceMap[K, V]) String ¶
func (m *SafeSliceMap[K, V]) String() string
func (*SafeSliceMap[K, V]) UnmarshalBinary ¶
func (m *SafeSliceMap[K, V]) UnmarshalBinary(data []byte) (err error)
func (*SafeSliceMap[K, V]) UnmarshalJSON ¶
func (m *SafeSliceMap[K, V]) UnmarshalJSON(data []byte) (err error)
func (*SafeSliceMap[K, V]) Values ¶
func (m *SafeSliceMap[K, V]) Values() (vals []V)
type Set ¶
type Set[K comparable] struct { // contains filtered or unexported fields }
func (*Set[K]) MarshalBinary ¶
func (*Set[K]) MarshalJSON ¶
func (*Set[K]) String ¶
Example ¶
m := new(Set[string]) m.Add("a") m.Add("b") m.Add("a") v := m.Values() sort.Strings(v) fmt.Print(v)
Output:
func (*Set[K]) UnmarshalBinary ¶
func (*Set[K]) UnmarshalJSON ¶
type Setter ¶
type Setter[K comparable, V any] interface { Set(K, V) }
type SliceMap ¶
type SliceMap[K comparable, V any] struct { // contains filtered or unexported fields }
func (*SliceMap[K, V]) GetAt ¶
Example ¶
m := new(SliceMap[string, int]) m.Set("b", 2) m.Set("c", 3) m.Set("a", 1) v := m.GetAt(1) fmt.Print(v)
Output:
func (*SliceMap[K, V]) GetKeyAt ¶
Example ¶
m := new(SliceMap[string, int]) m.Set("b", 2) m.Set("c", 3) m.Set("a", 1) v := m.GetKeyAt(1) fmt.Print(v)
Output:
func (*SliceMap[K, V]) MarshalBinary ¶
func (*SliceMap[K, V]) MarshalJSON ¶
func (*SliceMap[K, V]) SetAt ¶
Example ¶
m := new(SliceMap[string, int]) m.Set("b", 2) m.Set("a", 1) m.SetAt(1, "c", 3) fmt.Println(m)
Output:
func (*SliceMap[K, V]) SetSortFunc ¶
Example ¶
m := new(SliceMap[string, int]) m.Set("b", 2) m.Set("a", 1) fmt.Println(m) m.SetSortFunc(func(k1, k2 string, v1, v2 int) bool { return k1 < k2 }) fmt.Println(m)
Output:
func (*SliceMap[K, V]) UnmarshalBinary ¶
func (*SliceMap[K, V]) UnmarshalJSON ¶
type StdMap ¶
type StdMap[K comparable, V any] map[K]V
func Cast ¶
func Cast[M ~map[K]V, K comparable, V any](m M) StdMap[K, V]
Example ¶
m := map[string]int{"a": 1} b := Cast(m) fmt.Print(b.Len())
Output:
func NewStdMap ¶
func NewStdMap[K comparable, V any](sources ...map[K]V) StdMap[K, V]
func (StdMap[K, V]) MarshalBinary ¶
func (StdMap[K, V]) MarshalJSON ¶
func (*StdMap[K, V]) UnmarshalBinary ¶
func (*StdMap[K, V]) UnmarshalJSON ¶
Click to show internal directories.
Click to hide internal directories.