leveldb

package
v0.0.0-...-96f1409 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 27, 2022 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FieldTranslator

type FieldTranslator struct {
	// contains filtered or unexported fields
}

FieldTranslator is a pdk.FieldTranslator which uses leveldb.

func NewFieldTranslator

func NewFieldTranslator(dirname string, field string) (*FieldTranslator, error)

NewFieldTranslator creates a new FieldTranslator which uses LevelDB as backing storage.

func (*FieldTranslator) Close

func (lft *FieldTranslator) Close() error

Close closes the two leveldbs used by the FieldTranslator.

func (*FieldTranslator) Get

func (lft *FieldTranslator) Get(id uint64) (val interface{}, err error)

Get returns the value mapped to the given id.

func (*FieldTranslator) GetID

func (lft *FieldTranslator) GetID(val interface{}) (id uint64, err error)

GetID returns the integer id associated with the given value. It allocates a new ID if the value is not found.

type Translator

type Translator struct {
	// contains filtered or unexported fields
}

Translator is a pdk.Translator which stores the two way val/id mapping in leveldb.

func NewTranslator

func NewTranslator(dirname string, fields ...string) (lt *Translator, err error)

NewTranslator gets a new Translator.

func (*Translator) Close

func (lt *Translator) Close() error

Close closes all of the underlying leveldb instances.

func (*Translator) Get

func (lt *Translator) Get(field string, id uint64) (val interface{}, err error)

Get returns the value mapped to the given id in the given field.

func (*Translator) GetID

func (lt *Translator) GetID(field string, val interface{}) (id uint64, err error)

GetID returns the integer id associated with the given value in the given field. It allocates a new ID if the value is not found.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL