go-leveldb

command module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 15, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

README

go-leveldb

Build Status License GoDoc

go-leveldb is a Go wrapper for LevelDB

Building

You can run make to build this library. It will download and compile leveldb and snappy, then compile go-leveldb.

Alternatively, if you have installed libleveldb-dev on your machine, you can use go build to compile go-leveldb. However, if libleveldb-dev is installed in non-standard folders, you must set CGO_CFLAGS and CGO_LDFLAGS such that cgo knows the location of libleveldb-dev.

Usage

go-leveldb supports most functions of leveldb's C API, except those passing function pointers to the API.

Example code:

import "github.com/ccding/go-leveldb/leveldb"

// creates a database
db, err := leveldb.Open(dir, nil)
// put and get
err = db.Put([]byte("foo"), []byte("bar"), nil)
val, err := db.Get([]byte("foo"), nil) // returns "bar"
// closes the database
db.Close()
// deletes the database directory
err = leveldb.DestroyDB(dir, nil)

More details, please go to main.go and GoDoc

TODO

Write tests and comments

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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