leveldb

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2019 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateDirIfMissing

func CreateDirIfMissing(dir string) (bool, error)

CreateDirIfMissing creates directory to file system.

func DirEmpty

func DirEmpty(dir string) (bool, error)

DirEmpty retruns if directory path is empty.

Types

type Conf

type Conf struct {
	Path string
}

Conf holds leveldb path.

type DB

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

DB handles leveldb related things.

func NewDB

func NewDB(conf *Conf) *DB

NewDB instantiate DB struct.

func (*DB) Close

func (db *DB) Close()

Close closes designated leveldb.

func (*DB) Delete

func (db *DB) Delete(key []byte, sync bool) error

Delete deletes the value for the given key.

func (*DB) Get

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

Get gets the value for the given key.

func (*DB) GetIterator

func (db *DB) GetIterator(startKey, endKey []byte) iterator.Iterator

GetIterator returns an iterator for the latest snapshot of the underlying DB.

func (*DB) Open

func (db *DB) Open()

Open opens designated leveldb.

func (*DB) Put

func (db *DB) Put(key, value []byte, sync bool) error

Put sets the value for the given key. It overwrites any previous value for that key.

func (*DB) WriteBatch

func (db *DB) WriteBatch(batch *leveldb.Batch, sync bool) error

WriteBatch apply the given batch to the DB.

Jump to

Keyboard shortcuts

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