Versions in this module Expand all Collapse all v2 v2.0.0 Feb 19, 2022 Changes in this version + var ErrAlreadyUnsubscribed = errors.New("already unsubscribed") + var ErrSubscriptionNotInitalized = errors.New("subscription is not initialized") + func Abs(v T) T + func All(slice S, cond func(value E) bool) bool + func Any(slice S, cond func(value E) bool) bool + func Chunk(slice S, size int) []S + func ChunkFunc(slice S, size int, callback func(chunk S)) + func Clamp(v, min, max T) T + func Clamp01(v T) T + func ClearMap(m M) + func CloneMap(m M) M + func CloneSlice(slice S) S + func Coal(values ...T) T + func Compare(a, b T) int + func Concat(a, b S) S + func Contains(slice S, value E) bool + func ContainsFunc(slice S, value E, equals func(a, b E) bool) bool + func ContainsValue(m M, value V) bool + func DerefZero(ptr P) V + func Digits10(v T) int + func DigitsSign10(v T) int + func Distinct(slice S) S + func DistinctFunc(slice S, equals func(a, b E) bool) S + func Except(slice S, exclude S) S + func ExceptSet(slice S, exclude Set[E]) S + func Fill(slice S, value E) + func Filter(slice S, match func(value E) bool) S + func Fold(slice S, seed State, acc func(state State, value E) State) State + func FoldReverse(slice S, seed State, acc func(state State, value E) State) State + func GrowSlice(slice S, n int) S + func Index(slice S, value E) int + func IndexFunc(slice S, f func(value E) bool) int + func Insert(slice *S, index int, value E) + func InsertSlice(slice *S, index int, values S) + func IsNil(value T) bool + func IsZero(value T) bool + func Last(slice S) E + func Less(a, b T) bool + func MakeChanOf(_ V, size ...int) chan V + func MakeChanOfChan(_ C, size ...int) C + func MakeMapOf(_ K, _ V, size ...int) map[K]V + func MakeMapOfMap(_ M, size ...int) M + func MakeSliceOf(_ E, size ...int) []E + func MakeSliceOfKey(_ M, size ...int) []K + func MakeSliceOfSlice(_ S, size ...int) S + func MakeSliceOfValue(_ M, size ...int) []V + func Map(slice S, conv func(value E) Result) []Result + func MapErr(slice S, conv func(value E) (Result, error)) ([]Result, error) + func Max(v ...T) T + func Min(v ...T) T + func NewOf(*T) *T + func Pairs(slice S) [][2]E + func PairsFunc(slice S, callback func(a, b E)) + func Product(v ...T) T + func RecvContext(ctx context.Context, ch C) (V, bool) + func RecvQueued(ch C, maxValues int) []V + func RecvQueuedFull(ch C, buf B) int + func RecvTimeout(ch C, timeout time.Duration) (V, bool) + func Ref(value T) *T + func Remove(slice *S, index int) + func RemoveSlice(slice *S, index int, length int) + func Repeat(value E, count int) []E + func Reverse(slice S) + func SafeGet(slice S, index int) E + func SafeGetOr(slice S, index int, fallback E) E + func Search(slice S, value E) int + func SearchFunc(slice S, less func(a E) bool) int + func SendContext(ctx context.Context, ch C, value V) bool + func SendTimeout(ch C, value V, timeout time.Duration) bool + func Shuffle(slice S) + func ShuffleRand(slice S, rand *rand.Rand) + func Sort(slice S) + func SortDesc(slice S) + func SortDescFunc(slice S, less func(a, b E) bool) + func SortFunc(slice S, less func(a, b E) bool) + func SortStableDescFunc(slice S, less func(a, b E) bool) + func SortStableFunc(slice S, less func(a, b E) bool) + func Sum(v ...T) T + func Tern(cond bool, ifTrue, ifFalse T) T + func TernCast(cond bool, value any, ifFalse T) T + func Trim(slice S, unwanted S) S + func TrimFunc(slice S, unwanted func(value E) bool) S + func TrimLeft(slice S, unwanted S) S + func TrimLeftFunc(slice S, unwanted func(value E) bool) S + func TrimRight(slice S, unwanted S) S + func TrimRightFunc(slice S, unwanted func(value E) bool) S + func TryGet(slice S, index int) (E, bool) + func Windowed(slice S, size int) []S + func WindowedFunc(slice S, size int, callback func(window S)) + func Zero() T + func ZeroOf(T) T + type AVLTree struct + func NewAVLTree(compare func(a, b T) int) AVLTree[T] + func NewAVLTreeOrdered() AVLTree[T] + func (n *AVLTree[T]) Add(value T) + func (n *AVLTree[T]) Clear() + func (n *AVLTree[T]) Clone() AVLTree[T] + func (n *AVLTree[T]) Contains(value T) bool + func (n *AVLTree[T]) Len() int + func (n *AVLTree[T]) Remove(value T) bool + func (n *AVLTree[T]) SliceInOrder() []T + func (n *AVLTree[T]) SlicePostOrder() []T + func (n *AVLTree[T]) SlicePreOrder() []T + func (n *AVLTree[T]) WalkInOrder(walker func(value T)) + func (n *AVLTree[T]) WalkPostOrder(walker func(value T)) + func (n *AVLTree[T]) WalkPreOrder(walker func(value T)) + func (n AVLTree[T]) String() string + type Array2D struct + func NewArray2D(width, height int) Array2D[T] + func NewArray2DFromSlice(width, height int, jagged J) Array2D[E] + func NewArray2DFromValue(width, height int, value T) Array2D[T] + func (a Array2D[T]) Clone() Array2D[T] + func (a Array2D[T]) Fill(x1, y1, x2, y2 int, value T) + func (a Array2D[T]) Get(x, y int) T + func (a Array2D[T]) Height() int + func (a Array2D[T]) Row(y int) []T + func (a Array2D[T]) RowSpan(x1, x2, y int) []T + func (a Array2D[T]) Set(x, y int, value T) + func (a Array2D[T]) String() string + func (a Array2D[T]) Width() int + type AtomicValue struct + func (v *AtomicValue[T]) CompareAndSwap(old, new T) (swapped bool) + func (v *AtomicValue[T]) Load() (val T) + func (v *AtomicValue[T]) Store(val T) + func (v *AtomicValue[T]) Swap(new T) (old T) + type Chan interface + type Complex interface + type Counting struct + Count int + Key K + func CountBy(slice S, keyer func(value V) K) []Counting[K] + type Element struct + Value T + func (l *Element[T]) Next() *Element[T] + func (l *Element[T]) Prev() *Element[T] + type Float interface + type Grouping struct + Key K + Values []V + func GroupBy(slice S, keyer func(value V) K) []Grouping[K, V] + type Integer interface + type KeyedLocker interface + LockKey func(key T) + UnlockKey func(key T) + type KeyedMutex struct + func (km *KeyedMutex[T]) ClearKey(key T) + func (km *KeyedMutex[T]) LockKey(key T) + func (km *KeyedMutex[T]) TryLockKey(key T) bool + func (km *KeyedMutex[T]) UnlockKey(key T) + type KeyedRWMutex struct + func (km *KeyedRWMutex[T]) ClearKey(key T) + func (km *KeyedRWMutex[T]) LockKey(key T) + func (km *KeyedRWMutex[T]) RLockKey(key T) + func (km *KeyedRWMutex[T]) RUnlockKey(key T) + func (km *KeyedRWMutex[T]) TryLockKey(key T) bool + func (km *KeyedRWMutex[T]) TryRLockKey(key T) bool + func (km *KeyedRWMutex[T]) UnlockKey(key T) + type List struct + func NewList() *List[T] + func (l *List[T]) Back() *Element[T] + func (l *List[T]) Front() *Element[T] + func (l *List[T]) Init() *List[T] + func (l *List[T]) InsertAfter(v T, mark *Element[T]) *Element[T] + func (l *List[T]) InsertBefore(v T, mark *Element[T]) *Element[T] + func (l *List[T]) Len() int + func (l *List[T]) MoveAfter(e, mark *Element[T]) + func (l *List[T]) MoveBefore(e, mark *Element[T]) + func (l *List[T]) MoveToBack(e *Element[T]) + func (l *List[T]) MoveToFront(e *Element[T]) + func (l *List[T]) PushBack(v T) *Element[T] + func (l *List[T]) PushBackList(other *List[T]) + func (l *List[T]) PushFront(v T) *Element[T] + func (l *List[T]) PushFrontList(other *List[T]) + func (l *List[T]) Remove(e *Element[T]) T + type Null struct + Set bool + Val T + Valid bool + func NewNull(value T, valid bool) Null[T] + func NullFrom(value T) Null[T] + func NullFromPtr(ptr *T) Null[T] + func (n *Null[T]) Scan(value any) error + func (n *Null[T]) SetValid(value T) + func (n *Null[T]) UnmarshalJSON(data []byte) error + func (n *Null[T]) UnmarshalText(text []byte) error + func (n Null[T]) IsSet() bool + func (n Null[T]) IsValid() bool + func (n Null[T]) IsZero() bool + func (n Null[T]) MarshalJSON() ([]byte, error) + func (n Null[T]) MarshalText() ([]byte, error) + func (n Null[T]) Ptr() *T + func (n Null[T]) Value() (driver.Value, error) + type Number interface + type Ordered interface + type Pool struct + New func() T + func (p *Pool[T]) Get() T + func (p *Pool[T]) Put(x T) + type Publisher struct + OnPubTimeout func(ev T) + PubTimeoutAfter time.Duration + func (o *Publisher[T]) Pub(ev T) + func (o *Publisher[T]) PubSlice(evs []T) + func (o *Publisher[T]) PubSliceSync(evs []T) + func (o *Publisher[T]) PubSliceWait(evs []T) + func (o *Publisher[T]) PubSync(ev T) + func (o *Publisher[T]) PubWait(ev T) + func (o *Publisher[T]) Sub() <-chan T + func (o *Publisher[T]) SubBuf(size int) <-chan T + func (o *Publisher[T]) Unsub(sub <-chan T) error + func (o *Publisher[T]) UnsubAll() error + type Queue struct + func (q *Queue[T]) Dequeue() (T, bool) + func (q *Queue[T]) Enqueue(value T) + func (q *Queue[T]) Len() int + func (q *Queue[T]) Peek() (T, bool) + type Real interface + type RecvChan interface + type Ring struct + Value T + func NewRing(n int) *Ring[T] + func (r *Ring[T]) Do(f func(T)) + func (r *Ring[T]) Len() int + func (r *Ring[T]) Link(s *Ring[T]) *Ring[T] + func (r *Ring[T]) Move(n int) *Ring[T] + func (r *Ring[T]) Next() *Ring[T] + func (r *Ring[T]) Prev() *Ring[T] + func (r *Ring[T]) Unlink(n int) *Ring[T] + type SendChan interface + type Set map[T]struct + func CartesianProduct(a Set[TA], b Set[TB]) Set[SetProduct[TA, TB]] + func NewSetOfKeys(m M) Set[K] + func NewSetOfSlice(slice S) Set[E] + func NewSetOfValues(m M) Set[V] + func (s Set[T]) Add(value T) bool + func (s Set[T]) AddSet(set Set[T]) int + func (s Set[T]) Clone() Set[T] + func (s Set[T]) Has(value T) bool + func (s Set[T]) Intersect(other Set[T]) Set[T] + func (s Set[T]) Remove(value T) bool + func (s Set[T]) RemoveSet(set Set[T]) int + func (s Set[T]) SetDiff(other Set[T]) Set[T] + func (s Set[T]) Slice() []T + func (s Set[T]) String() string + func (s Set[T]) SymDiff(other Set[T]) Set[T] + func (s Set[T]) Union(other Set[T]) Set[T] + type SetProduct struct + A TA + B TB + type Signed interface + type SortedSlice struct + func NewSortedSlice(values S, less func(a, b E) bool) SortedSlice[E] + func NewSortedSliceOrdered(values ...T) SortedSlice[T] + func (s *SortedSlice[T]) Add(value T) int + func (s *SortedSlice[T]) Contains(value T) bool + func (s *SortedSlice[T]) Get(index int) T + func (s *SortedSlice[T]) Index(value T) int + func (s *SortedSlice[T]) Len() int + func (s *SortedSlice[T]) Remove(value T) int + func (s *SortedSlice[T]) RemoveAt(index int) + func (s SortedSlice[T]) String() string + type Stack []T + func (s *Stack[T]) Peek() (T, bool) + func (s *Stack[T]) Pop() (T, bool) + func (s *Stack[T]) Push(value T) + type SyncMap struct + 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) + type Unsigned interface Other modules containing this package gopkg.in/typ.v1 gopkg.in/typ.v3 gopkg.in/typ.v4