Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Trie ¶
type Trie struct {
// contains filtered or unexported fields
}
Trie stores a set of strings and can quickly check if it contains an element, or one of its parents.
It implements a semi-radix/semi-compressed trie: a node that would be a single child is merged with its parent, if it is a terminal.
The word "prefix" is avoided because in practice we use the `Trie` with `SplitTLD` so parents are suffixes even if in the datastructure they are prefixes.
func (*Trie) HasParentOf ¶
HasParentOf reports whether the trie contains key or one of its parents. On a match it also returns the labels of the matched entry; joining them with the separator used by the trie's SplitFunc reproduces the entry. The labels are nil when there is no match.
Click to show internal directories.
Click to hide internal directories.