Documentation
¶
Index ¶
- func Decode(data []byte, obj interface{}) error
- type Batch
- type Batcher
- type Corrector
- type Db
- func (db *Db) Close()
- func (db *Db) CreateTable(prefix []byte) *Tbl
- func (db *Db) Delete(key []byte) error
- func (db *Db) Get(key []byte) ([]byte, error)
- func (db *Db) GetObject(key []byte, obj interface{}) error
- func (db *Db) Has(key []byte) (bool, error)
- func (db *Db) NewBatch() *Batch
- func (db *Db) NewIterator() iterator.Iterator
- func (db *Db) NewIteratorPrefix(prefix []byte) iterator.Iterator
- func (db *Db) Put(key []byte, value []byte) error
- func (db *Db) PutObject(key []byte, obj interface{}) error
- type Reader
- type Tbl
- type TblBatch
- type Writer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Batch ¶
type Batch struct {
// contains filtered or unexported fields
}
Batch is some kind of temporary storage in RAM. Once you perform a series of operations, call the Write() method to unload information from the batch into the database.
func (*Batch) CreateTableBatch ¶
CreateTableBatch creates new tablebatch instance.
type Batcher ¶
type Batcher interface { // Put puts bytes to the batch. Put(key, value []byte) error // PutObject puts object to the batch. PutObject(key []byte, obj interface{}) error // Delete deletes value by key from the batch. Delete(key []byte) error // Write writes data from batch to the database Write() error // Reset resets batch. Reset() // CreateTableBatch creates new tablebatch instance. CreateTableBatch(prefix []byte) Batcher }
Batcher is a general representation of the batch, which can both tablebatch and batch.
type Corrector ¶
type Corrector interface { // Put puts bytes to the database. Put(key, value []byte) error // PutObject puts object to the database. PutObject(key []byte, obj interface{}) error // Delete deletes value by key from the database. Delete(key []byte) error // Get gets bytes from the database. Get(key []byte) ([]byte, error) // GetObject gets object from the database. GetObject(key []byte, obj interface{}) error // Has checks the presence of an element in the database. Has(key []byte) (bool, error) }
Corrector is a combination of Reader and Writer.
type Db ¶
type Db struct {
// contains filtered or unexported fields
}
Db is wrapper over the standard leveldb.DB.
func (*Db) CreateTable ¶
CreateTable creates new table instance.
func (*Db) NewIterator ¶
NewIterator creates new iterator instance.
func (*Db) NewIteratorPrefix ¶
NewIteratorPrefix creates new iterator instance with prefix.
type Reader ¶
type Reader interface { // Get gets bytes from the database. Get(key []byte) ([]byte, error) // GetObject gets object from the database. GetObject(key []byte, obj interface{}) error // Has checks the presence of an element in the database. Has(key []byte) (bool, error) }
Reader is a database object with read access.
type Tbl ¶
type Tbl struct {
// contains filtered or unexported fields
}
Tbl will in fact add a prefix to any records.
type TblBatch ¶
type TblBatch struct {
// contains filtered or unexported fields
}
TblBatch it's the same as batch, but with a prefix.
func (*TblBatch) CreateTableBatch ¶
CreateTableBatch creates new tablebatch instance.
type Writer ¶
type Writer interface { // Put puts bytes to the database. Put(key, value []byte) error // PutObject puts object to the database. PutObject(key []byte, obj interface{}) error // Delete deletes value by key from the database. Delete(key []byte) error }
Writer is a database object with write access.