Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func TransformArray ¶
func TransformArray[T, U any](arr []T, f func(T) U) []U
func TransformMaybeArray ¶
Types ¶
type Cache ¶
type Cache[T any] interface { // Get returns the object stored in the cache with the given key. // If the object has expired, it will be removed from the cache and nil will be returned. Get(key string) CacheObject[T] Set(key string, obj T) Clear() }
type MutablePair ¶
func NewMutablePair ¶
func NewMutablePair[L, R any](left L, right R) MutablePair[L, R]
type Queue ¶
type Queue[T comparable] interface { Enqueue(item T) Dequeue() (*T, error) IsEmpty() bool Size() int Items() []T RemoveFunc(func(T) bool) bool }
func NewQueue ¶
func NewQueue[T comparable]() Queue[T]
type SafeDoubleMap ¶
type SafeDoubleMap[K, V comparable] interface { SafeMap[K, V] RemoveByValue(V) }
func NewSafeDoubleMap ¶
func NewSafeDoubleMap[K, V comparable](m ...map[K]V) SafeDoubleMap[K, V]
type SafeMap ¶
type SafeMap[K comparable, V any] interface { Get(K) (V, bool) Put(K, V) Remove(K) Contains(K) bool Keys() []K Values() []V Size() int Copy() map[K]V // ForEach iterates over the map and calls the given function for each key-value pair. // The order of iteration is not guaranteed. If the function returns false, the iteration stops. // // As the map is read-locked during the iteration, the function should not call any method that modifies the map. ForEach(func(K, V) bool) }
func NewSafeMap ¶
func NewSafeMap[K comparable, V any](m ...map[K]V) SafeMap[K, V]
Click to show internal directories.
Click to hide internal directories.