Documentation
¶
Index ¶
- type Key
- type Keys
- type Range
- type Tree
- func (t *Tree) Delete(key Key) error
- func (t *Tree) Get(key Key) (value types.Value, err error)
- func (t *Tree) Iterate(pivot Key, reverse bool, fn func(Key, types.Value) error) error
- func (t *Tree) IterateOnRange(rng *Range, reverse bool, fn func(Key, types.Value) error) error
- func (t *Tree) Put(key Key, value types.Value) error
- func (t *Tree) Truncate() error
- type Value
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Range ¶
A Range of keys to iterate on. By default, Min and Max are inclusive. If Exclusive is true, Min and Max are excluded from the results. If Type is provided, the results will be filtered by that type.
type Tree ¶
A Tree is an abstraction over a k-v store that allows manipulating data using high level keys and values of the Genji type system. Trees are used as the basis for tables and indexes. The key of a tree is a composite combination of several values, while the value can be any value of Genji's type system. The tree ensures all keys are sort-ordered according to the rules of the types package operators. A Tree doesn't support duplicate keys.
func (*Tree) Delete ¶
Delete a key from the tree. If the key doesn't exist, it returns engine.ErrKeyNotFound.
func (*Tree) Get ¶
Get a key from the tree. If the key doesn't exist, it returns engine.ErrKeyNotFound.
func (*Tree) Iterate ¶
Iterate over the tree. If the pivot is nil and reverse is false, it iterates from the lowest key onwards. If the pivot is nil and reverse if true, it iterates from the highest key downwards. If the pivot is not nil, it seeks that key in the tree before iterating over anything equal, and higher or lower depending on if reverse is false or true.
func (*Tree) IterateOnRange ¶
IterateOnRange iterates on all keys that are in the given range. Depending on the direction, the range is translated to the following table: | SQL | Range | Direction | Seek | End | | ----- | ---------------- | --------- | ------- | ------- | | = 10 | Min: 10, Max: 10 | ASC | 10 | 10 | | > 10 | Min: 10, Excl | ASC | 10+0xFF | nil | | >= 10 | Min: 10 | ASC | 10 | nil | | < 10 | Max: 10, Excl | ASC | nil | 10 excl | | <= 10 | Max: 10 | ASC | nil | 10 | | = 10 | Min: 10, Max: 10 | DESC | 10+0xFF | 10 | | > 10 | Min: 10, Excl | DESC | nil | 10 excl | | >= 10 | Min: 10 | DESC | nil | 10 | | < 10 | Max: 10, Excl | DESC | 10 | nil | | <= 10 | Max: 10 | DESC | 10+0xFF | nil |
type Value ¶
type Value struct {
// contains filtered or unexported fields
}
Value is an implementation of the types.Value interface returned by Tree. It is used to lazily decode values from the underlying store.