Documentation
¶
Overview ¶
Package btree implements B-tree based collections for Go
See https://github.com/tidwall/btree for more information
Index ¶
- func CompareFor[T any]() func(T, T) int
- type Action
- type Array
- func (b *Array[T]) All() iter.Seq[T]
- func (b *Array[T]) AllMut() iter.Seq[T]
- func (b *Array[T]) Append(items ...T)
- func (b *Array[T]) Ascend(index int) iter.Seq[T]
- func (b *Array[T]) AscendMut(index int) iter.Seq[T]
- func (b *Array[T]) Back() (T, bool)
- func (b *Array[T]) BackMut() (T, bool)
- func (b *Array[T]) Backward() iter.Seq[T]
- func (b *Array[T]) BackwardMut() iter.Seq[T]
- func (b *Array[T]) Clear()
- func (b *Array[T]) Clone() *Array[T]
- func (b *Array[T]) Contains(item T) bool
- func (b *Array[T]) Delete(index int) (T, bool)
- func (b *Array[T]) Descend(index int) iter.Seq[T]
- func (b *Array[T]) DescendMut(index int) iter.Seq[T]
- func (b *Array[T]) Drain(index, count int) Extract[T]
- func (b *Array[T]) DrainOptions(index, count int, opts DrainOptions) Extract[T]
- func (b *Array[T]) Front() (T, bool)
- func (b *Array[T]) FrontMut() (T, bool)
- func (b *Array[T]) Get(index int) T
- func (b *Array[T]) GetMut(index int) T
- func (b *Array[T]) Insert(index int, item T) bool
- func (b *Array[T]) Len() int
- func (b *Array[T]) Lookup(index int) (T, bool)
- func (b *Array[T]) LookupMut(index int) (T, bool)
- func (b *Array[T]) PopBack() (T, bool)
- func (b *Array[T]) PopBackFunc(cond func(item T) bool) (T, bool)
- func (b *Array[T]) PopFront() (T, bool)
- func (b *Array[T]) PopFrontFunc(cond func(item T) bool) (T, bool)
- func (b *Array[T]) PushBack(item T)
- func (b *Array[T]) PushFront(item T)
- func (b *Array[T]) Release()
- func (b *Array[T]) Replace(index int, item T) (T, bool)
- func (b *Array[T]) String() string
- type ArrayOptions
- type Deque
- func (b *Deque[T]) All() iter.Seq[T]
- func (b *Deque[T]) AllMut() iter.Seq[T]
- func (b *Deque[T]) At(pos int) (T, bool)
- func (b *Deque[T]) AtMut(pos int) (T, bool)
- func (b *Deque[T]) Back() (T, bool)
- func (b *Deque[T]) BackMut() (T, bool)
- func (b *Deque[T]) Backward() iter.Seq[T]
- func (b *Deque[T]) BackwardMut() iter.Seq[T]
- func (b *Deque[T]) Clear()
- func (b *Deque[T]) Clone() *Deque[T]
- func (b *Deque[T]) Contains(item T) bool
- func (b *Deque[T]) Front() (T, bool)
- func (b *Deque[T]) FrontMut() (T, bool)
- func (b *Deque[T]) Len() int
- func (b *Deque[T]) PopBack() (T, bool)
- func (b *Deque[T]) PopBackFunc(cond func(item T) bool) (T, bool)
- func (b *Deque[T]) PopFront() (T, bool)
- func (b *Deque[T]) PopFrontFunc(cond func(item T) bool) (T, bool)
- func (b *Deque[T]) PushBack(item T)
- func (b *Deque[T]) PushFront(item T)
- func (b *Deque[T]) Release()
- func (b *Deque[T]) String() string
- type DequeOptions
- type DrainOptions
- type Extract
- type Extract2
- type Map
- func (b *Map[K, V]) Action(key K, action func(V) (V, Action))
- func (b *Map[K, V]) All() iter.Seq2[K, V]
- func (b *Map[K, V]) AllMut() iter.Seq2[K, V]
- func (b *Map[K, V]) Ascend(key K) iter.Seq2[K, V]
- func (b *Map[K, V]) AscendAt(index int) iter.Seq2[K, V]
- func (b *Map[K, V]) AscendAtMut(index int) iter.Seq2[K, V]
- func (b *Map[K, V]) AscendMut(key K) iter.Seq2[K, V]
- func (b *Map[K, V]) Back() (K, V, bool)
- func (b *Map[K, V]) BackMut() (K, V, bool)
- func (b *Map[K, V]) Backward() iter.Seq2[K, V]
- func (b *Map[K, V]) BackwardMut() iter.Seq2[K, V]
- func (b *Map[K, V]) Clear()
- func (b *Map[K, V]) Clone() *Map[K, V]
- func (b *Map[K, V]) Contains(key K) bool
- func (b *Map[K, V]) Delete(key K) (V, bool)
- func (b *Map[K, V]) DeleteAt(index int) (K, V, bool)
- func (b *Map[K, V]) DeleteFunc(del func(K, V) bool) bool
- func (b *Map[K, V]) Descend(key K) iter.Seq2[K, V]
- func (b *Map[K, V]) DescendAt(index int) iter.Seq2[K, V]
- func (b *Map[K, V]) DescendAtMut(index int) iter.Seq2[K, V]
- func (b *Map[K, V]) DescendMut(key K) iter.Seq2[K, V]
- func (b *Map[K, V]) Drain(min, max K) Extract2[K, V]
- func (b *Map[K, V]) DrainAt(index, count int) Extract2[K, V]
- func (b *Map[K, V]) DrainAtOptions(index, count int, opts DrainOptions) Extract2[K, V]
- func (b *Map[K, V]) DrainOptions(min, max K, opts DrainOptions) Extract2[K, V]
- func (b *Map[K, V]) Front() (K, V, bool)
- func (b *Map[K, V]) FrontMut() (K, V, bool)
- func (b *Map[K, V]) Get(key K) V
- func (b *Map[K, V]) GetAt(index int) (K, V)
- func (b *Map[K, V]) GetAtMut(index int) (K, V)
- func (b *Map[K, V]) IndexOf(key K) (int, bool)
- func (b *Map[K, V]) Insert(key K, value V) (V, bool)
- func (b *Map[K, V]) InsertAt(index int, key K, value V) bool
- func (b *Map[K, V]) Keys() iter.Seq[K]
- func (b *Map[K, V]) Len() int
- func (b *Map[K, V]) Lookup(key K) (V, bool)
- func (b *Map[K, V]) LookupAt(index int) (K, V, bool)
- func (b *Map[K, V]) LookupAtMut(index int) (K, V, bool)
- func (b *Map[K, V]) LookupMut(key K) (V, bool)
- func (b *Map[K, V]) PopBack() (K, V, bool)
- func (b *Map[K, V]) PopBackFunc(cond func(key K, value V) bool) (K, V, bool)
- func (b *Map[K, V]) PopFront() (K, V, bool)
- func (b *Map[K, V]) PopFrontFunc(cond func(key K, value V) bool) (K, V, bool)
- func (b *Map[K, V]) PushBack(key K, value V) bool
- func (b *Map[K, V]) PushFront(key K, value V) bool
- func (b *Map[K, V]) Release()
- func (b *Map[K, V]) Replace(key K, value V) (V, bool)
- func (b *Map[K, V]) ReplaceAt(index int, key K, value V) (K, V, bool)
- func (b *Map[K, V]) Seek(key K) (K, V, bool)
- func (b *Map[K, V]) SeekMut(key K) (K, V, bool)
- func (b *Map[K, V]) SeekNext(key K) (K, V, bool)
- func (b *Map[K, V]) SeekNextMut(key K) (K, V, bool)
- func (b *Map[K, V]) SeekPrev(key K) (K, V, bool)
- func (b *Map[K, V]) SeekPrevMut(key K) (K, V, bool)
- func (b *Map[K, V]) Set(key K, value V) (V, bool)
- func (b *Map[K, V]) String() string
- func (b *Map[K, V]) Values() iter.Seq[V]
- func (b *Map[K, V]) ValuesMut() iter.Seq[V]
- type MapOptions
- type Prique
- func (b *Prique[T]) All() iter.Seq[T]
- func (b *Prique[T]) AllMut() iter.Seq[T]
- func (b *Prique[T]) Clear()
- func (b *Prique[T]) Clone() *Prique[T]
- func (b *Prique[T]) Contains(key T) bool
- func (b *Prique[T]) Delete(key T) (T, bool)
- func (b *Prique[T]) Front() (T, bool)
- func (b *Prique[T]) FrontMut() (T, bool)
- func (b *Prique[T]) GetAt(pos int) T
- func (b *Prique[T]) GetAtMut(pos int) T
- func (b *Prique[T]) Len() int
- func (b *Prique[T]) LookupAt(pos int) (T, bool)
- func (b *Prique[T]) LookupAtMut(pos int) (T, bool)
- func (b *Prique[T]) Pop() (T, bool)
- func (b *Prique[T]) PopFunc(cond func(item T) bool) (T, bool)
- func (b *Prique[T]) Push(item T) bool
- func (b *Prique[T]) Release()
- func (b *Prique[T]) String() string
- type PriqueOptions
- type Queue
- func (b *Queue[T]) All() iter.Seq[T]
- func (b *Queue[T]) AllMut() iter.Seq[T]
- func (b *Queue[T]) At(pos int) (T, bool)
- func (b *Queue[T]) AtMut(pos int) (T, bool)
- func (b *Queue[T]) Clear()
- func (b *Queue[T]) Clone() *Queue[T]
- func (b *Queue[T]) Contains(item T) bool
- func (b *Queue[T]) Front() (T, bool)
- func (b *Queue[T]) FrontMut() (T, bool)
- func (b *Queue[T]) Len() int
- func (b *Queue[T]) Pop() (T, bool)
- func (b *Queue[T]) PopFunc(cond func(item T) bool) (T, bool)
- func (b *Queue[T]) Push(item T)
- func (b *Queue[T]) Release()
- func (b *Queue[T]) String() string
- type QueueOptions
- type Set
- func (b *Set[K]) All() iter.Seq[K]
- func (b *Set[K]) Ascend(key K) iter.Seq[K]
- func (b *Set[K]) AscendAt(index int) iter.Seq[K]
- func (b *Set[K]) Back() (K, bool)
- func (b *Set[K]) Backward() iter.Seq[K]
- func (b *Set[K]) Clear()
- func (b *Set[K]) Clone() *Set[K]
- func (b *Set[K]) Contains(key K) bool
- func (b *Set[K]) Delete(key K) bool
- func (b *Set[K]) DeleteAt(index int) (K, bool)
- func (b *Set[K]) DeleteFunc(del func(K) bool) bool
- func (b *Set[K]) Descend(key K) iter.Seq[K]
- func (b *Set[K]) DescendAt(index int) iter.Seq[K]
- func (b *Set[K]) Difference(other *Set[K]) *Set[K]
- func (b *Set[K]) DifferenceWith(other *Set[K])
- func (b *Set[K]) Drain(min, max K) Extract[K]
- func (b *Set[K]) DrainAt(index, count int) Extract[K]
- func (b *Set[K]) DrainAtOptions(index, count int, opts DrainOptions) Extract[K]
- func (b *Set[K]) DrainOptions(min, max K, opts DrainOptions) Extract[K]
- func (b *Set[K]) Equal(other *Set[K]) bool
- func (b *Set[K]) Front() (K, bool)
- func (b *Set[K]) GetAt(index int) K
- func (b *Set[K]) IndexOf(key K) (int, bool)
- func (b *Set[K]) Insert(key K) bool
- func (b *Set[K]) InsertAt(index int, key K) bool
- func (b *Set[K]) Intersection(other *Set[K]) *Set[K]
- func (b *Set[K]) IntersectionWith(other *Set[K])
- func (b *Set[K]) Intersects(other *Set[K]) bool
- func (b *Set[K]) Len() int
- func (b *Set[K]) LookupAt(index int) (K, bool)
- func (b *Set[K]) PopBack() (K, bool)
- func (b *Set[K]) PopFront() (K, bool)
- func (b *Set[K]) PushBack(key K) bool
- func (b *Set[K]) PushFront(key K) bool
- func (b *Set[K]) Release()
- func (b *Set[K]) ReplaceAt(index int, key K) (K, bool)
- func (b *Set[K]) Seek(key K) (K, bool)
- func (b *Set[K]) SeekNext(key K) (K, bool)
- func (b *Set[K]) SeekPrev(key K) (K, bool)
- func (b *Set[K]) String() string
- func (b *Set[K]) SymmetricDifference(other *Set[K]) *Set[K]
- func (b *Set[K]) SymmetricDifferenceWith(other *Set[K])
- func (b *Set[K]) Union(other *Set[K]) *Set[K]
- func (b *Set[K]) UnionWith(other *Set[K])
- type Stack
- func (b *Stack[T]) All() iter.Seq[T]
- func (b *Stack[T]) AllMut() iter.Seq[T]
- func (b *Stack[T]) At(pos int) (T, bool)
- func (b *Stack[T]) AtMut(pos int) (T, bool)
- func (b *Stack[T]) Clear()
- func (b *Stack[T]) Clone() *Stack[T]
- func (b *Stack[K]) Contains(item K) bool
- func (b *Stack[T]) Len() int
- func (b *Stack[T]) Pop() (T, bool)
- func (b *Stack[T]) Push(item T)
- func (b *Stack[T]) Release()
- func (b *Stack[K]) String() string
- func (b *Stack[T]) Top() (T, bool)
- func (b *Stack[T]) TopMut() (T, bool)
- type StackOptions
- type Table
- func (b *Table[T]) All() iter.Seq[T]
- func (b *Table[T]) AllMut() iter.Seq[T]
- func (b *Table[T]) Ascend(pivot T) iter.Seq[T]
- func (b *Table[T]) AscendAt(index int) iter.Seq[T]
- func (b *Table[T]) AscendAtMut(index int) iter.Seq[T]
- func (b *Table[T]) AscendMut(pivot T) iter.Seq[T]
- func (b *Table[T]) Back() (T, bool)
- func (b *Table[T]) BackMut() (T, bool)
- func (b *Table[T]) Backward() iter.Seq[T]
- func (b *Table[T]) BackwardMut() iter.Seq[T]
- func (b *Table[T]) Clear()
- func (b *Table[T]) Clone() *Table[T]
- func (b *Table[T]) Contains(key T) bool
- func (b *Table[T]) Delete(key T) (T, bool)
- func (b *Table[T]) DeleteAt(index int) (T, bool)
- func (b *Table[T]) Descend(pivot T) iter.Seq[T]
- func (b *Table[T]) DescendAt(index int) iter.Seq[T]
- func (b *Table[T]) DescendAtMut(index int) iter.Seq[T]
- func (b *Table[T]) DescendMut(pivot T) iter.Seq[T]
- func (b *Table[T]) Drain(min, max T) Extract[T]
- func (b *Table[T]) DrainAt(index, count int) Extract[T]
- func (b *Table[T]) DrainAtOptions(index, count int, opts DrainOptions) Extract[T]
- func (b *Table[T]) DrainOptions(min, max T, opts DrainOptions) Extract[T]
- func (b *Table[T]) Front() (T, bool)
- func (b *Table[T]) FrontMut() (T, bool)
- func (b *Table[T]) Get(key T) T
- func (b *Table[T]) GetAt(index int) T
- func (b *Table[T]) GetAtMut(index int) T
- func (b *Table[T]) GetMut(key T) T
- func (b *Table[T]) IndexOf(key T) (int, bool)
- func (b *Table[T]) Insert(item T) (T, bool)
- func (b *Table[T]) InsertAt(index int, item T) bool
- func (b *Table[T]) Len() int
- func (b *Table[T]) Lookup(key T) (T, bool)
- func (b *Table[T]) LookupAt(index int) (T, bool)
- func (b *Table[T]) LookupAtMut(index int) (T, bool)
- func (b *Table[T]) LookupMut(key T) (T, bool)
- func (b *Table[T]) PopBack() (T, bool)
- func (b *Table[T]) PopBackFunc(cond func(item T) bool) (T, bool)
- func (b *Table[T]) PopFront() (T, bool)
- func (b *Table[T]) PopFrontFunc(cond func(item T) bool) (T, bool)
- func (b *Table[T]) PushBack(item T) bool
- func (b *Table[T]) PushFront(item T) bool
- func (b *Table[T]) Release()
- func (b *Table[T]) Replace(item T) (T, bool)
- func (b *Table[T]) ReplaceAt(index int, item T) (T, bool)
- func (b *Table[T]) Seek(key T) (T, bool)
- func (b *Table[T]) SeekMut(key T) (T, bool)
- func (b *Table[T]) SeekNext(key T) (T, bool)
- func (b *Table[T]) SeekNextMut(key T) (T, bool)
- func (b *Table[T]) SeekPrev(key T) (T, bool)
- func (b *Table[T]) SeekPrevMut(key T) (T, bool)
- func (b *Table[T]) Set(item T) (T, bool)
- func (b *Table[T]) String() string
- type TableOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CompareFor ¶
Return a compare function for type or nil if type is not comparable
Types ¶
type Array ¶
type Array[T any] struct { // contains filtered or unexported fields }
Array is btree backed array for storing arbritary items.
func NewArrayOptions ¶
func NewArrayOptions[T any](opts ArrayOptions[T]) *Array[T]
NewArrayOptions returns a new array with options
func (*Array[T]) BackwardMut ¶
Backward returns an iterator over the items in reverse order MUTABLE OPERATION
func (*Array[T]) Clone ¶
Clone the array. This is a fast O(1) operation using a copy-on-write method.
func (*Array[T]) Delete ¶
Delete item at index. Returns item and true if inserted or false if index is out of bounds
func (*Array[T]) DescendMut ¶
DescendMut returns an iterator starting at index, in reverse order. MUTABLE OPERATION
func (*Array[T]) Drain ¶
DrainOptions will delete all items within the provided index and count sub-range. Returns the deleted items as an ordered extract that can be iterated over.
func (*Array[T]) DrainOptions ¶
func (b *Array[T]) DrainOptions(index, count int, opts DrainOptions, ) Extract[T]
DrainOptions will delete all items within the provided index and count sub-range. Returns the deleted items as an ordered extract that can be iterated over.
func (*Array[T]) Insert ¶
Insert an item at index, moving existing items over by one. Returns true if item was inserted, or false if index is out of bounds. Use index=0 to insert front and index=arr.Len() to insert back.
func (*Array[T]) LookupMut ¶
Lookup returns item at index or false if out of bounds. MUTABLE OPERTAION
func (*Array[T]) PopBackFunc ¶
PopBackFunc removed last item if allowed by the provided function.
func (*Array[T]) PopFrontFunc ¶
PopFrontFunc removed first item if allowed by the provided function.
func (*Array[T]) PushBack ¶
func (b *Array[T]) PushBack(item T)
PushBack adds item to back of array.
func (*Array[T]) PushFront ¶
func (b *Array[T]) PushFront(item T)
PushFront adds item to front of array.
func (*Array[T]) Release ¶
func (b *Array[T]) Release()
Release clears the array and release any references. This method is functionally equivalent to Clear() but is an optimization for collections that are cloned using Clone().
type ArrayOptions ¶
type ArrayOptions[T any] struct { Copy func(T) T // Copy item function Release func(T) // Release item function }
ArrayOptions are options for NewArrayOptions()
type Deque ¶
type Deque[T any] struct { // contains filtered or unexported fields }
Deque is a double-ended queue
func NewDequeOptions ¶
func NewDequeOptions[T any](opts DequeOptions[T]) *Deque[T]
NewDequeOptions returns a new deque
func (*Deque[T]) AllMut ¶
All returns an iterator of all items starting with the first. MUTABLE OPERATION.
func (*Deque[T]) At ¶
At returns the item At position, after first, in queue. Returns false if no item is found At position.
func (*Deque[T]) AtMut ¶
AtMut returns the item at position, after first, in queue. Returns false if no item is found at position. MUTABLE OPERATION.
func (*Deque[T]) BackwardMut ¶
BackwardMut returns an iterator of all items starting with the last. MUTABLE OPERATION.
func (*Deque[T]) Clone ¶
Clone the queue. This is a fast O(1) operation using a copy-on-write method.
func (*Deque[T]) PopBackFunc ¶
PopBackFunc removes last item if provided function allows.
func (*Deque[T]) PopFrontFunc ¶
PopFrontFunc removes first item if provided function allows.
func (*Deque[T]) PushBack ¶
func (b *Deque[T]) PushBack(item T)
PushFront inserts item to back of queue
func (*Deque[T]) PushFront ¶
func (b *Deque[T]) PushFront(item T)
PushFront inserts item to front of queue
type DequeOptions ¶
type DequeOptions[T any] struct { Copy func(T) T // Copy item function Release func(T) // Release item function }
DequeOptions are options for deque collection
type DrainOptions ¶
type DrainOptions struct {
NoReturn bool // Do not return items
MinExclusive bool // Exclude the min arg
MaxInclusive bool // Include the max arg
}
DrainOptions for deleting a range of items from a collection.
type Extract2 ¶
type Extract2[K, V any] interface { Len() int All() iter.Seq2[K, V] Backward() iter.Seq2[K, V] Keys() iter.Seq[K] Values() iter.Seq[V] }
Extract2 is a slice of items that can be iterated forward or backward.
type Map ¶
Map is sorted collection of key value pairs
func NewMapOptions ¶
func NewMapOptions[K cmp.Ordered, V any](opts MapOptions[K, V]) *Map[K, V]
NewMapOptions returns a new map
func (*Map[K, V]) Action ¶
Action performs an action on item with key. The "action" function is called when the item is found. Returning an Action type from action function to: - ActionGet: do nothing - ActionDelete: delete item - ActionReplace: replace with returned value
func (*Map[K, V]) AscendAtMut ¶
AscendAtMut returns an iterator starting at index MUTABLE OPERATION
func (*Map[K, V]) BackwardMut ¶
BackwardMut returns an iterator of all items in map, in reverse order. MUTABLE OPERATION
func (*Map[K, V]) Clone ¶
Clone the map. This is a fast O(1) operation using a copy-on-write method.
func (*Map[K, V]) DeleteFunc ¶
DeleteFunc delete item from map if its allowed by del function.
func (*Map[K, V]) DescendAtMut ¶
DescendAtMut returns an iterator starting at index, in reverse order MUTABLE OPERATION
func (*Map[K, V]) DescendMut ¶
DescendMut returns an iterator with items less than key, in reverse order. MUTABLE OPERATION
func (*Map[K, V]) Drain ¶
Drain will delete all items within the provided min (inclusive) and max (exclusive) sub-range. Returns the deleted items as an ordered extract that can be iterated over.
func (*Map[K, V]) DrainAt ¶
DrainAt will delete all items within the provided index and count sub-range. Returns the deleted items as an ordered extract that can be iterated over.
func (*Map[K, V]) DrainAtOptions ¶
func (b *Map[K, V]) DrainAtOptions(index, count int, opts DrainOptions, ) Extract2[K, V]
DrainAtOptions will delete all items within the provided index and count sub-range. Returns the deleted items as an ordered extract that can be iterated over.
func (*Map[K, V]) DrainOptions ¶
func (b *Map[K, V]) DrainOptions(min, max K, opts DrainOptions) Extract2[K, V]
DrainOptions will delete all items within the provided min (inclusive) and max (exclusive) sub-range. Returns the deleted items as an ordered extract that can be iterated over.
func (*Map[K, V]) LookupAtMut ¶
LookupAtMut returns item at index MUTABLE OPERATION
func (*Map[K, V]) LookupMut ¶
Lookup an item Returns true if found or false if not found MUTABLE OPERATION
func (*Map[K, V]) PopBackFunc ¶
PopBackFunc removes last item if provided function allows.
func (*Map[K, V]) PopFrontFunc ¶
PopFrontFunc removes first item if provided function allows.
func (*Map[K, V]) Release ¶
func (b *Map[K, V]) Release()
Release clears the map and release any references. This method is functionally equivalent to Clear() but is an optimization for collections that are cloned.
func (*Map[K, V]) SeekNextMut ¶
SeekNextMut returns the first item that is > key MUTABLE OPERATION
func (*Map[K, V]) SeekPrevMut ¶
SeekPrevMut returns the first item that is < key MUTABLE OPERATION
type MapOptions ¶
type MapOptions[K cmp.Ordered, V any] struct { Copy func(V) V // Copy function Release func(V) // Release function NoPrefix bool // Do not use string prefixes }
MapOptions for NewMapOptions
type Prique ¶
type Prique[T any] struct { // contains filtered or unexported fields }
Prique is a priority queue
func NewPriqueOptions ¶
func NewPriqueOptions[T any](opts PriqueOptions[T]) *Prique[T]
NewPriqueOptions returns a new priority queue
func (*Prique[T]) Clone ¶
Clone the queue. This is a fast O(1) operation using a copy-on-write method.
func (*Prique[T]) Delete ¶
Delete item with the provided key. If duplicate items with the same key exist, only one will be deleted; specifically the oldest duplicate item is deleted.
func (*Prique[T]) GetAtMut ¶
GetAtMut returns the item at position, after first, in queue. MUTABLE OPERATION.
func (*Prique[T]) LookupAt ¶
LookupAt returns the item at position, after first, in queue. Returns false if no item is found at position.
func (*Prique[T]) LookupAtMut ¶
LookupAtMut returns the item at position, after first, in queue. Returns false if no item is found at position. MUTABLE OPERATION.
type PriqueOptions ¶
type PriqueOptions[T any] struct { Compare func(T, T) int // Standard comparator Less func(T, T) bool // Less comparator Copy func(T) T // Copy function Release func(T) // Release function }
PriqueOptions for NewPriqueOptions()
type Queue ¶
type Queue[T any] struct { // contains filtered or unexported fields }
Queue provides the functionality of a queue - specifically, a FIFO (first-in, first-out) data structure.
func NewQueueOptions ¶
func NewQueueOptions[T any](opts QueueOptions[T]) *Queue[T]
NewQueueOptions returns a new queue
func (*Queue[T]) AllMut ¶
All returns an iterator of all items starting with the first. MUTABLE OPERATION.
func (*Queue[T]) At ¶
At returns the item At position, after first, in queue. Returns false if no item is found At position.
func (*Queue[T]) AtMut ¶
AtMut returns the item at position, after first, in queue. Returns false if no item is found at position. MUTABLE OPERATION.
func (*Queue[T]) Clone ¶
Clone the queue. This is a fast O(1) operation using a copy-on-write method.
func (*Queue[T]) FrontMut ¶
FrontMut returns the first item in queue, or false if queue is empty. MUTABLE OPERATION.
type QueueOptions ¶
type QueueOptions[T any] struct { Copy func(T) T // Copy function Release func(T) // Release function }
QueueOptions are options for NewQueueOptoins
type Set ¶
Set is a b-tree set of keys
func (*Set[K]) DeleteFunc ¶
DeleteFunc delete item if its allowed by del function.
func (*Set[K]) Difference ¶
Difference returns a new set containing keys that are in target set but not in other.
func (*Set[K]) DifferenceWith ¶
DifferenceWith removes any items from set that are in other.
func (*Set[K]) Drain ¶
Drain will delete all items within the provided min (inclusive) and max (exclusive) sub-range. Returns the deleted items as an ordered extract that can be iterated over.
func (*Set[K]) DrainAt ¶
DeleteRangeOptions will delete all items within the provided min (inclusive) and max (exclusive) sub-range. Returns the deleted items as an ordered extract that can be iterated over.
func (*Set[K]) DrainAtOptions ¶
func (b *Set[K]) DrainAtOptions(index, count int, opts DrainOptions, ) Extract[K]
DrainAtOptions will delete all items within the provided index and count sub-range. Returns the deleted items as an ordered extract that can be iterated over.
func (*Set[K]) DrainOptions ¶
func (b *Set[K]) DrainOptions(min, max K, opts DrainOptions, ) Extract[K]
DrainOptions will delete all items within the provided min (inclusive) and max (exclusive) sub-range. Returns the deleted items as an ordered extract that can be iterated over.
func (*Set[K]) InsertAt ¶
InsertAt inserts key at index. Returns false if out of order or out of bounds
func (*Set[K]) Intersection ¶
Intersection returns a new set containing item that are in both sets.
func (*Set[K]) IntersectionWith ¶
IntersectionWith removes any items from set that are not in other.
func (*Set[K]) Intersects ¶
Intersects returns true if other and s share any items.
func (*Set[K]) Release ¶
func (b *Set[K]) Release()
Release clears the set and release any references. This method is functionally equivalent to Clear() but is an optimization for collections that are cloned.
func (*Set[K]) SymmetricDifference ¶
SymmetricDifference returns a new set containing items that are in either, but not both.
func (*Set[K]) SymmetricDifferenceWith ¶
SymmetricDifferenceWith update set to the symmetric difference of both sets
type Stack ¶
type Stack[T any] struct { // contains filtered or unexported fields }
Stack provides the functionality of a stack - specifically, a LIFO (last-in, first-out) data structure.
func NewStackOptions ¶
func NewStackOptions[T any](opts StackOptions[T]) *Stack[T]
NewStackOptions returns a new stack
func (*Stack[T]) AllMut ¶
AllMut returns an iterator of all items starting from the top of the stack. MUTABLE OPERATION.
func (*Stack[T]) At ¶
At returns the item At position, after top, in Stack. Returns false if no item is found At position.
func (*Stack[T]) AtMut ¶
AtMut returns the item at position, after top, in Stack. Returns false if no item is found at position. MUTABLE OPERATION.
func (*Stack[T]) Clone ¶
Clone the stack. This is a fast O(1) operation using a copy-on-write method.
func (*Stack[T]) Release ¶
func (b *Stack[T]) Release()
Release clears the stack and releases any copied reference. This method is functionally equivalent to Clear() but is an optimization for collections that are copied using Clone().
type StackOptions ¶
type StackOptions[T any] struct { Copy func(T) T // Copy function Release func(T) // Release function }
StackOptions for NewStackOptions()
type Table ¶
type Table[T any] struct { // contains filtered or unexported fields }
Table is a B-tree backed in-memory collection for general purpose items.
func NewTableOptions ¶
func NewTableOptions[T any](opts TableOptions[T]) *Table[T]
func (*Table[T]) BackwardMut ¶
func (*Table[T]) DescendMut ¶
func (*Table[T]) DrainAtOptions ¶
func (b *Table[T]) DrainAtOptions(index, count int, opts DrainOptions, ) Extract[T]
func (*Table[T]) DrainOptions ¶
func (b *Table[T]) DrainOptions(min, max T, opts DrainOptions) Extract[T]
func (*Table[T]) LookupAtMut ¶
func (*Table[T]) PopBackFunc ¶
func (*Table[T]) PopFrontFunc ¶
func (*Table[T]) SeekNextMut ¶
func (*Table[T]) SeekPrevMut ¶
type TableOptions ¶
type TableOptions[T any] struct { Compare func(T, T) int // Standard comparator Less func(T, T) bool // Less comparator Copy func(T) T // Copy function Release func(T) // Release function }
TableOptions for NewTableOptions()