Documentation
¶
Index ¶
- type Node
- func (n *Node[T]) Count() int
- func (n *Node[T]) Equal(other *Node[T], equalFn func(a T, b T) bool) bool
- func (n *Node[T]) GetAllLeafs() []T
- func (n *Node[T]) GetClosestNode(keyParts []string) *Node[T]
- func (n *Node[T]) GetNode(keyParts []string) (*Node[T], bool)
- func (n *Node[T]) Iterate(f func(key string, value T))
- type Trie
- func (t *Trie[T]) Equal(other *Trie[T], equalFn func(a T, b T) bool) bool
- func (t *Trie[T]) Get(key string) (T, bool)
- func (t *Trie[T]) GetClosest(key string) (string, T)
- func (t *Trie[T]) Insert(key string, value T)
- func (t *Trie[T]) Iterate(f func(key string, value T))
- func (t *Trie[T]) SearchPrefix(key string) []T
- func (t *Trie[T]) Size() int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Node ¶
type Node[T any] struct { // contains filtered or unexported fields }
func (*Node[T]) GetAllLeafs ¶
func (n *Node[T]) GetAllLeafs() []T
func (*Node[T]) GetClosestNode ¶ added in v0.0.2
type Trie ¶
type Trie[T any] struct { // contains filtered or unexported fields }
Trie is a simplified version of a Radix tree (https://en.wikipedia.org/wiki/Radix_tree#:~:text=In%20computer%20science%2C%20a%20radix,is%20merged%20with%20its%20parent.) Trie can be used to search for objects based on a key prefix To improve performance, the key is split by a separator instead of a common characters.
func (*Trie[T]) GetClosest ¶ added in v0.0.2
GetClosest returns the value for the closest key
func (*Trie[T]) SearchPrefix ¶
SearchPrefix search for all values that within the data structure with a given prefix Note that the prefix key will be split by the separator
Click to show internal directories.
Click to hide internal directories.