typeutils

package module
v0.0.0-...-4ebe608 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 27, 2025 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Overview

Package typeutils exposes utilities to inspect generic types.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyIter

func ApplyIter[E any](seq iter.Seq[E], apply func(*E)) iter.Seq[E]

func ConcatIter

func ConcatIter[E any](seqs ...iter.Seq[E]) iter.Seq[E]

ConcatIter concatenates a list of iterators.

func FilterIter

func FilterIter[E any](seq iter.Seq[E], filter func(E) bool) iter.Seq[E]

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 TransformErrIter[E any, F any](seq iter.Seq[E], transform func(E) (F, error)) iter.Seq[F]

func TransformIter

func TransformIter[E any, F any](seq iter.Seq[E], transform func(E) (F, bool)) iter.Seq[F]

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]) Clear

func (m *SyncMap[K, V]) Clear(key K)

func (*SyncMap[K, V]) CompareAndDelete

func (m *SyncMap[K, V]) CompareAndDelete(key V, old V) (deleted bool)

func (*SyncMap[K, V]) CompareAndSwap

func (m *SyncMap[K, V]) CompareAndSwap(key V, old, new V) (swapped bool)

func (*SyncMap[K, V]) Delete

func (m *SyncMap[K, V]) Delete(key K)

func (*SyncMap[K, V]) Load

func (m *SyncMap[K, V]) Load(key K) (value V, ok bool)

func (*SyncMap[K, V]) LoadAndDelete

func (m *SyncMap[K, V]) LoadAndDelete(key K) (value V, loaded bool)

func (*SyncMap[K, V]) LoadOrStore

func (m *SyncMap[K, V]) LoadOrStore(key K, value V) (actual V, loaded bool)

func (*SyncMap[K, V]) Range

func (m *SyncMap[K, V]) Range(f func(key K, value V) bool)

func (*SyncMap[K, V]) Store

func (m *SyncMap[K, V]) Store(key K, value V)

func (*SyncMap[K, V]) Swap

func (m *SyncMap[K, V]) Swap(key K, value V) (previous V, loaded bool)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL