Documentation
¶
Index ¶
- Constants
- Variables
- type Item
- type Prefix
- type Trie
- func (trie *Trie) Delete(key Prefix) (deleted bool)
- func (trie *Trie) Get(key Prefix) (item Item)
- func (trie *Trie) GetLongestPrefixNode(prefix Prefix) (item Item)
- func (trie *Trie) Insert(key Prefix, item Item) (inserted bool)
- func (trie *Trie) Item() Item
- func (trie *Trie) Match(prefix Prefix) (matchedExactly bool)
- func (trie *Trie) Set(key Prefix, item Item)
- func (trie *Trie) Visit(visitor VisitorFunc) error
- func (trie *Trie) VisitAndUpdate(visitor UpdateFunc, handle Item) error
- type UpdateFunc
- type VisitorFunc
Constants ¶
View Source
const ( DefaultMaxPrefixPerNode = 4 DefaultMaxChildrenPerSparseNode = 2 )
Variables ¶
View Source
var ( SkipSubtree = errors.New("Skip this subtree") ErrNilPrefix = errors.New("Nil prefix passed into a method call") )
Functions ¶
This section is empty.
Types ¶
type Trie ¶
type Trie struct {
// contains filtered or unexported fields
}
func (*Trie) Delete ¶
Delete deletes the item represented by the given prefix.
True is returned if the matching node was found and deleted.
func (*Trie) GetLongestPrefixNode ¶
func (*Trie) Insert ¶
Insert inserts a new item into the trie using the given prefix. Insert does not replace existing items. It returns false if an item was already in place.
func (*Trie) Match ¶
Match returns what Get(prefix) != nil would return. The same warning as for Get applies here as well.
func (*Trie) Set ¶
Set works much like Insert, but it always sets the item, possibly replacing the item previously inserted.
func (*Trie) Visit ¶
func (trie *Trie) Visit(visitor VisitorFunc) error
Visit calls visitor on every node containing a non-nil item in alphabetical order.
func (*Trie) VisitAndUpdate ¶
func (trie *Trie) VisitAndUpdate(visitor UpdateFunc, handle Item) error
Visit calls visitor on every node containing a non-nil item in alphabetical order.
type VisitorFunc ¶
Click to show internal directories.
Click to hide internal directories.