Documentation
¶
Index ¶
- type Trie
- func (t *Trie[T]) Add(key string, value T)
- func (t *Trie[T]) Common(prefix string, minLength int) (rv []string)
- func (t *Trie[T]) Del(key string) (ok bool)
- func (t *Trie[T]) Find(key string) (value T, ok bool)
- func (t *Trie[T]) Iter(prefix string, walker func(key string, value T))
- func (t *Trie[T]) String() string
- func (t *Trie[T]) Suggest(prefix string) (rv []string, ok bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Trie ¶
type Trie[T any] struct { // contains filtered or unexported fields }
Trie represents generic prefix-tree.
func (*Trie[T]) Common ¶ added in v1.3.0
Common returns slice of common keys with at least `minLength` of their length Pass prefix="" to find all commons whithin given length Resulting slice is sorted by overall matching keys count, key with most goes first.
func (*Trie[T]) Iter ¶ added in v1.2.0
Iter iterates over trie by prefix using dfs. Pass prefix="" to iterate over whole trie.
Click to show internal directories.
Click to hide internal directories.