leveldb

package
v3.3.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2019 License: LGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

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

DB is the leveldb databse

func NewDB

func NewDB(path string) (*DB, error)

NewDB return new leveldb

func (*DB) BeginBatch

func (d *DB) BeginBatch() error

BeginBatch will start the batch transaction

func (*DB) Close

func (d *DB) Close() error

Close will close the database

func (*DB) CommitBatch

func (d *DB) CommitBatch() error

CommitBatch will commit the batch transaction

func (*DB) Delete

func (d *DB) Delete(key []byte) error

Delete will remove the specify key

func (*DB) Get

func (d *DB) Get(key []byte) ([]byte, error)

Get return the value of the specify key

func (*DB) Has

func (d *DB) Has(key []byte) (bool, error)

Has returns whether the specified key exists

func (*DB) Keys

func (d *DB) Keys(prefix []byte) ([][]byte, error)

Keys returns the list of key prefixed with prefix

func (*DB) NewIteratorByPrefix added in v1.1.0

func (d *DB) NewIteratorByPrefix(prefix []byte) interface{}

NewIteratorByPrefix returns a new iterator by prefix

func (*DB) Put

func (d *DB) Put(key []byte, value []byte) error

Put will insert the key-value pair

func (*DB) Size

func (d *DB) Size() (int64, error)

Size returns the size of leveldb

type Iter added in v1.1.0

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

Iter is the iterator for leveldb

func (*Iter) Error added in v1.1.0

func (i *Iter) Error() error

Error returns the error of iterator

func (*Iter) Key added in v1.1.0

func (i *Iter) Key() []byte

Key returns the key of current item

func (*Iter) Next added in v1.1.0

func (i *Iter) Next() bool

Next do next item of iterator

func (*Iter) Release added in v1.1.0

func (i *Iter) Release()

Release will release the iterator

func (*Iter) Value added in v1.1.0

func (i *Iter) Value() []byte

Value returns the value of current item

Jump to

Keyboard shortcuts

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