Documentation ¶
Overview ¶
Package boltdb provides a pdk.Translator implementation using boltdb. BoltDB is great, but this package is not particularly well-used or tested, and it is recommended that one use the leveldb translator instead which has better write performance.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Translator ¶
Translator is a pdk.Translator which stores the two way val/id mapping in boltdb. It only accepts string values to map.
func NewTranslator ¶
func NewTranslator(filename string, fields ...string) (bt *Translator, err error)
NewTranslator gets a new Translator
func (*Translator) BulkAdd ¶
func (bt *Translator) BulkAdd(field string, values [][]byte) error
BulkAdd adds many values to a field at once, allocating ids.
func (*Translator) Close ¶
func (bt *Translator) Close() error
Close syncs and closes the underlying boltdb.
func (*Translator) Get ¶
func (bt *Translator) Get(field string, id uint64) (val interface{})
Get returns the previously mapped value to the monotonic id generated from GetID. For BoltTranslator, val will always be a []byte.