Documentation ¶
Index ¶
- type Tree
- func (t *Tree) Delete(s string) (Value, bool)
- func (t *Tree) Get(s string) (Value, bool)
- func (t *Tree) Insert(s string, v Value) (Value, bool, error)
- func (t *Tree) Len() int
- func (t *Tree) LongestPrefix(s string) (string, Value, bool)
- func (t *Tree) Walk(fn WalkFn)
- func (t *Tree) WalkPrefix(prefix string, fn WalkFn)
- type Value
- type WalkFn
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Tree ¶
type Tree struct {
// contains filtered or unexported fields
}
Tree implements a radix tree. This can be treated as a Dictionary abstract data type. The main advantage over a standard hash map is prefix-based lookups and ordered iteration
func (*Tree) Delete ¶
Delete is used to delete a key, returns the previous value and if it was deleted
func (*Tree) Insert ¶
Insert is used to add or update a new entry into the Tree. Returns true if the Tree was updated Returns error if there is an error replacing an edge. If this happens, the tree is considered broken.
func (*Tree) LongestPrefix ¶
LongestPrefix is like Get, but instead of an exact match, it will return the longest prefix match.
func (*Tree) WalkPrefix ¶
WalkPrefix is used to walk the tree under a prefix
Click to show internal directories.
Click to hide internal directories.