Documentation
¶
Overview ¶
Package typeutils exposes utilities to inspect generic types.
Index ¶
- func ApplyIter[E any](seq iter.Seq[E], apply func(*E)) iter.Seq[E]
- func ConcatIter[E any](seqs ...iter.Seq[E]) iter.Seq[E]
- func FilterIter[E any](seq iter.Seq[E], filter func(E) bool) iter.Seq[E]
- func IsZero(data interface{}) bool
- func MergeMaps[M ~map[K]V, K comparable, V any](target M, merged ...M) M
- func TransformErrIter[E any, F any](seq iter.Seq[E], transform func(E) (F, error)) iter.Seq[F]
- func TransformIter[E any, F any](seq iter.Seq[E], transform func(E) (F, bool)) iter.Seq[F]
- func VisitOnceIter[E comparable](seq iter.Seq[E]) iter.Seq[E]
- type SyncMap
- func (m *SyncMap[K, V]) Clear(key K)
- func (m *SyncMap[K, V]) CompareAndDelete(key V, old V) (deleted bool)
- func (m *SyncMap[K, V]) CompareAndSwap(key V, old, new V) (swapped bool)
- func (m *SyncMap[K, V]) Delete(key K)
- func (m *SyncMap[K, V]) Load(key K) (value V, ok bool)
- func (m *SyncMap[K, V]) LoadAndDelete(key K) (value V, loaded bool)
- func (m *SyncMap[K, V]) LoadOrStore(key K, value V) (actual V, loaded bool)
- func (m *SyncMap[K, V]) Range(f func(key K, value V) bool)
- func (m *SyncMap[K, V]) Store(key K, value V)
- func (m *SyncMap[K, V]) Swap(key K, value V) (previous V, loaded bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConcatIter ¶
ConcatIter concatenates a list of iterators.
func IsZero ¶
func IsZero(data interface{}) bool
IsZero returns true when the value passed into the function is a zero value. This allows for safer checking of interface values.
func MergeMaps ¶
func MergeMaps[M ~map[K]V, K comparable, V any](target M, merged ...M) M
MergeMaps merges maps into the target.
func TransformErrIter ¶
func TransformIter ¶
func VisitOnceIter ¶
func VisitOnceIter[E comparable](seq iter.Seq[E]) iter.Seq[E]
Types ¶
type SyncMap ¶
type SyncMap[K comparable, V any] struct { // contains filtered or unexported fields }
SyncMap is a generic wrapper around sync.Map.
func (*SyncMap[K, V]) CompareAndDelete ¶
func (*SyncMap[K, V]) CompareAndSwap ¶
func (*SyncMap[K, V]) LoadAndDelete ¶
func (*SyncMap[K, V]) LoadOrStore ¶
Click to show internal directories.
Click to hide internal directories.