Documentation
¶
Index ¶
- func Transform[K comparable, V any, R any](om *Map[K, V], f func(k K, v V) R) iter.Seq[R]
- func TransformSlice[K comparable, V any, R any](om *Map[K, V], f func(k K, v V) R) []R
- type Map
- func (om *Map[K, V]) All() iter.Seq2[K, V]
- func (om *Map[K, V]) Clear()
- func (om *Map[K, V]) Clone() *Map[K, V]
- func (om *Map[K, V]) CollectKeys() []K
- func (om *Map[K, V]) CollectValues() []V
- func (om *Map[K, V]) Delete(k K) V
- func (om *Map[K, V]) DeleteOk(k K) (V, bool)
- func (om *Map[K, V]) Entries() []Pair[K, V]
- func (om *Map[K, V]) Filter(f func(k K, v V) bool) *Map[K, V]
- func (om *Map[K, V]) Get(k K) V
- func (om *Map[K, V]) GetOk(k K) (V, bool)
- func (om *Map[K, V]) Keys() iter.Seq[K]
- func (om *Map[K, V]) Len() int
- func (om *Map[K, V]) MarshalJSON() ([]byte, error)
- func (om *Map[K, V]) MarshalJSONTo(enc *jsontext.Encoder) error
- func (om *Map[K, V]) Push(k K, v V)
- func (om *Map[K, V]) Set(k K, v V)
- func (om *Map[K, V]) String() string
- func (om *Map[K, V]) Transform[R any](f func(k K, v V) R) iter.Seq[R]
- func (om *Map[K, V]) TransformSlice[R any](f func(k K, v V) R) []R
- func (om *Map[K, V]) UnmarshalJSON(data []byte) error
- func (om *Map[K, V]) UnmarshalJSONFrom(dec *jsontext.Decoder) error
- func (om *Map[K, V]) Values() iter.Seq[V]
- type Pair
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func TransformSlice ¶
func TransformSlice[K comparable, V any, R any](om *Map[K, V], f func(k K, v V) R) []R
Types ¶
type Map ¶
type Map[K comparable, V any] struct { // contains filtered or unexported fields }
func New ¶
func New[K comparable, V any]() *Map[K, V]
func (*Map[K, V]) CollectKeys ¶
func (om *Map[K, V]) CollectKeys() []K
func (*Map[K, V]) CollectValues ¶
func (om *Map[K, V]) CollectValues() []V
func (*Map[K, V]) MarshalJSON ¶
MarshalJSON implements jsonv1.Marshaler with encoding/json v1 semantics. Encoders aware of jsonv2.MarshalerTo call Map.MarshalJSONTo instead.
func (*Map[K, V]) MarshalJSONTo ¶ added in v2.2.0
MarshalJSONTo implements jsonv2.MarshalerTo. It encodes the map as a JSON object, preserving insertion order.
func (*Map[K, V]) TransformSlice ¶ added in v2.1.0
func (*Map[K, V]) UnmarshalJSON ¶
UnmarshalJSON implements jsonv1.Unmarshaler with encoding/json v1 semantics. Decoders aware of jsonv2.UnmarshalerFrom call Map.UnmarshalJSONFrom instead.
func (*Map[K, V]) UnmarshalJSONFrom ¶ added in v2.2.0
UnmarshalJSONFrom implements jsonv2.UnmarshalerFrom. It decodes a JSON object, preserving the order of its members. Entries already held by the map are discarded.
type Pair ¶
type Pair[K comparable, V any] struct { Key K Value V }
Click to show internal directories.
Click to hide internal directories.