Documentation ¶
Overview ¶
Package trie provides a SuffixTrie data structure that can be used to index data by suffixes of strings.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SuffixTrie ¶
type SuffixTrie[T any] struct { // contains filtered or unexported fields }
SuffixTrie represents a trie data structure for suffixes
func NewSuffixTrie ¶
func NewSuffixTrie[T any]() *SuffixTrie[T]
NewSuffixTrie creates a new SuffixTrie
func (*SuffixTrie[T]) Delete ¶
func (t *SuffixTrie[T]) Delete(suffix string)
Delete deletes a suffix from the SuffixTrie
func (*SuffixTrie[T]) Get ¶
func (t *SuffixTrie[T]) Get(key string) (*T, bool)
Get returns the value for the first suffix that matches the given key Example: if the trie contains the suffixes "foo" and "foobar" and the key is "foobarbaz", the value for "foo" will be returned
func (*SuffixTrie[T]) Insert ¶
func (t *SuffixTrie[T]) Insert(suffix string, value *T)
Insert stores the value for a given suffix
Click to show internal directories.
Click to hide internal directories.