Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExampleRange ¶
func ExampleRange()
Types ¶
type TSMap ¶
type TSMap[K any, V any] interface { // Get returns the value associated with the given key and whether it was Get(key K) (V, bool) // Set sets the value associated with the given key. Set(key K, value V) // Delete deletes the value associated with the given key. Delete(key K) // Len returns the number of items in the map. Len() int // Range calls fn sequentially for each key and value present in the map. // but if exception exists and return true, fn will not be called. Range(fn Operation[K, V], exception ...Exception[K, V]) }
TSMap is a thread-safe map with specific key/value type.
func New ¶
func New[K comparable, V any]() TSMap[K, V]
New returns a new TSMap[K, V] that uses sync.Map for synchronization.
func NewMutex ¶
func NewMutex[K comparable, V any]() TSMap[K, V]
NewMutex returns a new TSMap[K, V] that uses map[K]V and a mutex for synchronization.
func NewSync ¶
func NewSync[K comparable, V any]() TSMap[K, V]
NewSync returns a new TSMap[K, V] that uses sync.Map for synchronization.
Click to show internal directories.
Click to hide internal directories.