Documentation ¶
Overview ¶
Package radix implement a radix tree. It is expected that the keys are in UTF-8 (i.e. go runes), and that insertion and lookup is far more common than deletion.
Index ¶
- type Iterator
- type Radix
- func (rad *Radix) Delete(key string) interface{}
- func (rad *Radix) Insert(key string, value interface{}) error
- func (rad *Radix) Iterator() *Iterator
- func (rad *Radix) Lookup(key string) interface{}
- func (rad *Radix) Prefix(prefix string) *list.List
- func (rad *Radix) Set(key string, value interface{}) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Iterator ¶
type Iterator struct { // Key of the element Key string // Value assigned to current element Value interface{} // contains filtered or unexported fields }
Iterator is an iterator of a Radix Tree.
It is useful for navigating the radix in alphabetical order:
for it := r.Iterator(); it != nil; it.Next() { // do something with it.Value or it.Key }
type Radix ¶
type Radix struct {
// contains filtered or unexported fields
}
Radix is a radix tree.
func (*Radix) Insert ¶
Insert put a value in the radix. It returns an error if the given key is already in use.
func (*Radix) Iterator ¶
Iterator returns a new iterator for a given Radix tree. If the tree is empty, a nil Iterator will be return.
Click to show internal directories.
Click to hide internal directories.