Documentation
¶
Index ¶
- Constants
- type BPTree
- func (t *BPTree) Add(k keyType, v valType)
- func (t *BPTree) Close()
- func (t *BPTree) Del(k keyType) (keyType, valType)
- func (t *BPTree) Get(k keyType) (keyType, valType)
- func (t *BPTree) GetClosest(k keyType) (keyType, valType)
- func (t *BPTree) Has(k keyType) bool
- func (t *BPTree) Len() int
- func (t *BPTree) Max() (keyType, valType)
- func (t *BPTree) Min() (keyType, valType)
- func (t *BPTree) Put(k keyType, v valType) bool
- func (t *BPTree) Range(iter func(k keyType, v valType) bool)
- func (t *BPTree) Size() int64
Constants ¶
const M = 4 //128
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BPTree ¶
type BPTree struct {
// contains filtered or unexported fields
}
BPTree represents the root of a b+tree the only thing needed to start a new tree is to simply call bpt := new(BPTree)
func (*BPTree) Add ¶
func (t *BPTree) Add(k keyType, v valType)
Add inserts a new record using the provided key. It only inserts an record if the key does not already exist.
func (*BPTree) Del ¶
func (t *BPTree) Del(k keyType) (keyType, valType)
Del removes the record for the supplied key and attempts to return the previous key and value
func (*BPTree) Get ¶
func (t *BPTree) Get(k keyType) (keyType, valType)
Get returns the record for a given key if it exists
func (*BPTree) GetClosest ¶
func (t *BPTree) GetClosest(k keyType) (keyType, valType)
GetClosest attempts to return the closest match in the tree if an explicit match cannot be found
func (*BPTree) Has ¶
Has returns a boolean indicating weather or not the provided key and associated record exists.
func (*BPTree) Max ¶
func (t *BPTree) Max() (keyType, valType)
Max returns the maximum (highest) key and value pair in the tree
func (*BPTree) Min ¶
func (t *BPTree) Min() (keyType, valType)
Min returns the minimum (lowest) key and value pair in the tree
func (*BPTree) Put ¶
Put is mainly used when you wish to upsert as it assumes the data to already be contained the tree. It will overwrite duplicate keys, as it does not check to see if the key exists