Documentation
¶
Index ¶
- type ComplexKeyMap
- func (m ComplexKeyMap[K, V]) Add(other ComplexKeyMap[K, V], onConflict func(v, newV V) V)
- func (m ComplexKeyMap[K, V]) ContainsKey(k K) bool
- func (m ComplexKeyMap[K, V]) Delete(k K)
- func (m ComplexKeyMap[K, V]) Get(k K) optionals.Optional[V]
- func (m ComplexKeyMap[K, V]) GetOrCompute(k K, computeValue func() (V, error)) (V, error)
- func (m ComplexKeyMap[K, V]) GetOrComputeNoError(k K, computeValue func() V) V
- func (m ComplexKeyMap[K, V]) GetOrDefault(k K) V
- func (m ComplexKeyMap[K, V]) GetOrValue(k K, value V) V
- func (m ComplexKeyMap[K, V]) IsEmpty() bool
- func (m ComplexKeyMap[K, V]) MarshalJSON() ([]byte, error)
- func (m ComplexKeyMap[K, V]) Put(k K, v V)
- func (m ComplexKeyMap[K, V]) Size() int
- func (m *ComplexKeyMap[K, V]) UnmarshalJSON(text []byte) error
- func (m ComplexKeyMap[K, V]) Upsert(k K, v V, onConflict func(v, newV V) V)
- type Map
- func (m Map[K, V]) Add(other Map[K, V], onConflict func(v, newV V) V)
- func (m Map[K, V]) ComputeIfAbsent(k K, computeValue func() (V, error)) error
- func (m Map[K, V]) ComputeIfAbsentNoError(k K, computeValue func() V)
- func (m Map[K, V]) ContainsKey(k K) bool
- func (m Map[K, V]) Delete(k K)
- func (m Map[K, V]) Get(k K) optionals.Optional[V]
- func (m Map[K, V]) GetOrCompute(k K, computeValue func() (V, error)) (V, error)
- func (m Map[K, V]) GetOrComputeNoError(k K, computeValue func() V) V
- func (m Map[K, V]) GetOrDefault(k K) V
- func (m Map[K, V]) GetOrValue(k K, value V) V
- func (m Map[K, V]) IsEmpty() bool
- func (m Map[K, V]) KeySet() sets.Set[K]
- func (m Map[K, V]) Keys() []K
- func (m Map[K, V]) Put(k K, v V)
- func (m Map[K, V]) PutIfAbsent(k K, v V)
- func (m Map[K, V]) Size() int
- func (m Map[K, V]) Upsert(k K, v V, onConflict func(v, newV V) V)
- func (m Map[K, V]) Values() []V
- type SliceElt
- type TimeMap
- func (m TimeMap[V]) Add(other TimeMap[V], onConflict func(v, newV V) V)
- func (m TimeMap[V]) ComputeIfAbsent(k time.Time, computeValue func() (V, error)) error
- func (m TimeMap[V]) ComputeIfAbsentNoError(k time.Time, computeValue func() V)
- func (m TimeMap[V]) ContainsKey(k time.Time) bool
- func (m TimeMap[V]) Delete(k time.Time)
- func (m TimeMap[V]) Get(k time.Time) optionals.Optional[V]
- func (m TimeMap[V]) GetOrCompute(k time.Time, computeValue func() (V, error)) (V, error)
- func (m TimeMap[V]) GetOrComputeNoError(k time.Time, computeValue func() V) V
- func (m TimeMap[V]) GetOrDefault(k time.Time) V
- func (m TimeMap[V]) GetOrValue(k time.Time, value V) V
- func (m TimeMap[V]) IsEmpty() bool
- func (m TimeMap[V]) KeySet() sets.Set[time.Time]
- func (m TimeMap[V]) Keys() []time.Time
- func (m TimeMap[V]) Put(k time.Time, v V)
- func (m TimeMap[V]) PutIfAbsent(k time.Time, v V)
- func (m TimeMap[V]) Size() int
- func (m TimeMap[V]) Upsert(k time.Time, v V, onConflict func(v, newV V) V)
- func (m TimeMap[V]) Values() []V
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ComplexKeyMap ¶
type ComplexKeyMap[K comparable, V any] map[K]V
A map whose keys are complex enough that the map is represented in JSON as a list of key-value pairs.
func NewComplexKeyMap ¶
func NewComplexKeyMap[K comparable, V any]() ComplexKeyMap[K, V]
func (ComplexKeyMap[K, V]) Add ¶
func (m ComplexKeyMap[K, V]) Add(other ComplexKeyMap[K, V], onConflict func(v, newV V) V)
func (ComplexKeyMap[K, V]) ContainsKey ¶
func (m ComplexKeyMap[K, V]) ContainsKey(k K) bool
func (ComplexKeyMap[K, V]) Delete ¶
func (m ComplexKeyMap[K, V]) Delete(k K)
func (ComplexKeyMap[K, V]) Get ¶
func (m ComplexKeyMap[K, V]) Get(k K) optionals.Optional[V]
func (ComplexKeyMap[K, V]) GetOrCompute ¶
func (m ComplexKeyMap[K, V]) GetOrCompute(k K, computeValue func() (V, error)) (V, error)
Returns the value associated with the given key k. If the key does not already exist in the map, the supplied function is called, and the resulting value is entered into the map and returned.
func (ComplexKeyMap[K, V]) GetOrComputeNoError ¶
func (m ComplexKeyMap[K, V]) GetOrComputeNoError(k K, computeValue func() V) V
A version of GetOrCompute that is guaranteed to not error.
func (ComplexKeyMap[K, V]) GetOrDefault ¶
func (m ComplexKeyMap[K, V]) GetOrDefault(k K) V
Returns the value associated with the given key k. If the key does not already exist in the map, the default Go value is returned.
func (ComplexKeyMap[K, V]) GetOrValue ¶
func (m ComplexKeyMap[K, V]) GetOrValue(k K, value V) V
Returns the value associated with the given key k. If the key does not already exist in the map, the supplied value is entered into the map and returned.
func (ComplexKeyMap[K, V]) IsEmpty ¶
func (m ComplexKeyMap[K, V]) IsEmpty() bool
func (ComplexKeyMap[K, V]) MarshalJSON ¶
func (m ComplexKeyMap[K, V]) MarshalJSON() ([]byte, error)
func (ComplexKeyMap[K, V]) Put ¶
func (m ComplexKeyMap[K, V]) Put(k K, v V)
func (ComplexKeyMap[K, V]) Size ¶
func (m ComplexKeyMap[K, V]) Size() int
func (*ComplexKeyMap[K, V]) UnmarshalJSON ¶
func (m *ComplexKeyMap[K, V]) UnmarshalJSON(text []byte) error
func (ComplexKeyMap[K, V]) Upsert ¶
func (m ComplexKeyMap[K, V]) Upsert(k K, v V, onConflict func(v, newV V) V)
type Map ¶
type Map[K comparable, V any] map[K]V
func NewMap ¶
func NewMap[K comparable, V any]() Map[K, V]
func (Map[K, V]) ComputeIfAbsent ¶
If the key k is not already in the map, then it is entered into the map with the result of calling the supplied function. If the function returns an error, then the map is not modified, and the error is returned.
func (Map[K, V]) ComputeIfAbsentNoError ¶
func (m Map[K, V]) ComputeIfAbsentNoError(k K, computeValue func() V)
If the key k is not already in the map, then it is entered into the map with the result of calling the supplied function.
func (Map[K, V]) ContainsKey ¶
func (Map[K, V]) GetOrCompute ¶
Returns the value associated with the given key k. If the key does not already exist in the map, the supplied function is called, and the resulting value is entered into the map and returned.
func (Map[K, V]) GetOrComputeNoError ¶
func (m Map[K, V]) GetOrComputeNoError(k K, computeValue func() V) V
Returns the value associated with the given key k. If the key does not already exist in the map, the supplied function is called, and the resulting value is entered into the map and returned.
func (Map[K, V]) GetOrDefault ¶
func (m Map[K, V]) GetOrDefault(k K) V
Returns the value associated with the given key k. If the key does not already exist in the map, the default Go value is returned.
func (Map[K, V]) GetOrValue ¶
func (m Map[K, V]) GetOrValue(k K, value V) V
Returns the value associated with the given key k. If the key does not already exist in the map, the supplied value is entered into the map and returned.
func (Map[K, V]) PutIfAbsent ¶
func (m Map[K, V]) PutIfAbsent(k K, v V)
If the key k is not already in the map, then it is entered into the map with the value v.
type SliceElt ¶
type SliceElt[K comparable, V any] struct { Key K `json:"key"` Value V `json:"value"` }
type TimeMap ¶
type TimeMap[V any] struct { // contains filtered or unexported fields }
func NewTimeMap ¶
func (TimeMap[V]) ComputeIfAbsent ¶
If the key k is not already in the map, then it is entered into the map with the result of calling the supplied function. If the function returns an error, then the map is not modified, and the error is returned.
func (TimeMap[V]) ComputeIfAbsentNoError ¶
If the key k is not already in the map, then it is entered into the map with the result of calling the supplied function.
func (TimeMap[V]) GetOrCompute ¶
Returns the value associated with the given key k. If the key does not already exist in the map, the supplied function is called, and the resulting value is entered into the map and returned.
func (TimeMap[V]) GetOrComputeNoError ¶
Returns the value associated with the given key k. If the key does not already exist in the map, the supplied function is called, and the resulting value is entered into the map and returned.
func (TimeMap[V]) GetOrDefault ¶
Returns the value associated with the given key k. If the key does not already exist in the map, the default Go value is returned.
func (TimeMap[V]) GetOrValue ¶
Returns the value associated with the given key k. If the key does not already exist in the map, the supplied value is entered into the map and returned.
func (TimeMap[V]) PutIfAbsent ¶
If the key k is not already in the map, then it is entered into the map with the value v.