Documentation
¶
Index ¶
- func CopyMap[K comparable, T any](orig map[K]T, usePointerCopier ...bool) map[K]T
- func CopyPointer[T any](orig *T, usePointerCopier ...bool) *T
- func CopySlice[T any](orig []T, usePointerCopier ...bool) []T
- func RunParallel(tasks ...func())
- func SliceOf[A any, B any](orig []A) (dst []B)
- type CustomMutex
- type DeepCopier
- type LimitedSafeMap
- type LimitedSafeMapOrderBy
- type Nullable
- type RWLocker
- type SafeMap
- type SafeMapEmbedded
- type SafeMapGenerator
- type SafeMapLambda
- type SafeSlice
- type SafeSliceIndex
- type SafeSliceUnlock
- type SimpleMap
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CopyMap ¶
func CopyMap[K comparable, T any](orig map[K]T, usePointerCopier ...bool) map[K]T
func CopyPointer ¶
func RunParallel ¶
func RunParallel(tasks ...func())
Types ¶
type CustomMutex ¶
type CustomMutex interface {
Lock(ctx context.Context) error
Unlock()
TryLock(ctx context.Context) bool
TryUnlock() bool
}
func NewMutex ¶
func NewMutex() CustomMutex
type DeepCopier ¶
type DeepCopier[T any] interface { Copy() *T }
type LimitedSafeMap ¶
type LimitedSafeMap[K comparable, T any] interface { SafeMap[K, T] Sorted() []T }
func NewLimitedSafeMap ¶
func NewLimitedSafeMap[K comparable, T any](limit int, sortBy LimitedSafeMapOrderBy[T]) LimitedSafeMap[K, T]
type LimitedSafeMapOrderBy ¶
type Nullable ¶
type Nullable[T any] struct { // contains filtered or unexported fields }
func (Nullable[T]) MarshalJSON ¶
func (*Nullable[T]) UnmarshalJSON ¶
type SafeMap ¶
type SafeMap[K comparable, T any] interface { Get(key K) (T, bool) Delete(key K) bool Has(key K) bool Set(key K, value T) Size() int Find(fn SafeMapLambda[T]) (T, bool) Search(fn SafeMapLambda[T]) (values []T) Each(fn SafeMapLambda[T]) }
func NewSafeMap ¶
func NewSafeMap[K comparable, T any]() SafeMap[K, T]
type SafeMapEmbedded ¶
type SafeMapEmbedded[K comparable, T any] interface { Get(key K) T Delete(key K) (ok bool) Each(fn SafeMapLambda[T]) Size() int }
func NewSafeMapEmbedded ¶
func NewSafeMapEmbedded[K comparable, T any](gen SafeMapGenerator[T]) SafeMapEmbedded[K, T]
type SafeMapGenerator ¶
type SafeMapGenerator[T any] func() T
type SafeMapLambda ¶
type SafeSlice ¶
type SafeSlice[T any] interface { json.Marshaler json.Unmarshaler Read() []T Remove(i int) Size() int Get(i int) T Set(i int, v T) Add(T) Index(fn SafeSliceIndex[T]) int Lock() (unlock SafeSliceUnlock) Replace([]T) }
func NewSafeSlice ¶
type SafeSliceIndex ¶
type SafeSliceUnlock ¶
type SafeSliceUnlock func()
type SimpleMap ¶
type SimpleMap[K comparable, T any] interface { Set(key K, value T) Delete(key K) (ok bool) Get(key K) (value T, ok bool) Size() int Each(fn func(key K, value T)) }
func NewSimpleMap ¶
func NewSimpleMap[K comparable, T any]() SimpleMap[K, T]
Click to show internal directories.
Click to hide internal directories.