leveldb

package
v3.6.0 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2021 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) KeysByRange

func (d *DB) KeysByRange(from []byte, to []byte, limit int) ([][]byte, error)

Keys returns the list of key prefixed with prefix

func (*DB) NewIteratorByPrefix

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

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

Iter is the iterator for leveldb

func (*Iter) Error

func (i *Iter) Error() error

Error returns the error of iterator

func (*Iter) Key

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

Key returns the key of current item

func (*Iter) Next

func (i *Iter) Next() bool

Next do next item of iterator

func (*Iter) Release

func (i *Iter) Release()

Release will release the iterator

func (*Iter) Value

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