goleveldb

module
v0.0.0-...-1975910 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2013 License: BSD-2-Clause

README

This is an implementation of the LevelDB key/value database in the Go programming language.

Installation

go get github.com/syndtr/goleveldb/leveldb

Usage

Create or open a database:

db, err := leveldb.OpenFile("path/to/db", &opt.Options{Flag: opt.OFCreateIfMissing})
...

Read or modify the database content:

ro := &opt.ReadOptions{}
wo := &opt.WriteOptions{}
data, err := db.Get([]byte("key"), ro)
...
err = db.Put([]byte("key"), []byte("value"), wo)
...
err = db.Delete([]byte("key"), wo)
...

Iterate over database content:

iter := db.NewIterator(ro)
for iter.Next() {
	key := iter.Key()
	value := iter.Value()
	...
}
err = iter.Error()
...

Batch writes:

batch := new(leveldb.Batch)
batch.Put([]byte("foo"), []byte("value"))
batch.Put([]byte("bar"), []byte("another value"))
batch.Delete([]byte("baz"))
err = db.Write(batch, wo)
...

Use bloom filter:

o := &opt.Options{
	Flag:   opt.OFCreateIfMissing,
	Filter: filter.NewBloomFilter(10),
}
db, err := leveldb.Open(stor, o)
...

Documentation

You can read package documentation here.

Directories

Path Synopsis
Package leveldb provides implementation of LevelDB key/value database.
Package leveldb provides implementation of LevelDB key/value database.
block
Package block allows read and write sorted key/value.
Package block allows read and write sorted key/value.
cache
Package cache provides interface and implementation of a cache algorithms.
Package cache provides interface and implementation of a cache algorithms.
comparer
Package comparer provides interface and implementation for ordering sets of data.
Package comparer provides interface and implementation for ordering sets of data.
errors
Package errors implements functions to manipulate errors.
Package errors implements functions to manipulate errors.
filter
Package filter provides interface and implementation of probabilistic data structure.
Package filter provides interface and implementation of probabilistic data structure.
hash
Package hash provides hashing utilities used by leveldb.
Package hash provides hashing utilities used by leveldb.
iterator
Package iterator provides interface and implementation to traverse over contents of a database.
Package iterator provides interface and implementation to traverse over contents of a database.
journal
Package journal allows read and write sequence of data block.
Package journal allows read and write sequence of data block.
memdb
Package memdb provide in-memory key/value database implementation.
Package memdb provide in-memory key/value database implementation.
opt
Package opt provides sets of options used by LevelDB.
Package opt provides sets of options used by LevelDB.
storage
Package storage provides storage abstraction for LevelDB.
Package storage provides storage abstraction for LevelDB.
table
Package table allows read and write sorted key/value.
Package table allows read and write sorted key/value.
manualtest

Jump to

Keyboard shortcuts

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