Go bindings for ForestDB
- Obtain and build forestdb: https://github.com/couchbaselabs/forestdb (run
make install
to install the library) - Install header files to system location
- On Ubuntu 14.04:
cd <forestdb_project_dir> && mkdir /usr/local/include/libforestdb && cp include/libforestdb/* /usr/local/include/libforestdb
go get -u -v -t github.com/couchbase/goforestdb
See godocs
// Open a database
db, _ := Open("test", nil)
// Close it properly when we're done
defer db.Close()
// Store the document
doc, _ := NewDoc([]byte("key"), nil, []byte("value"))
defer doc.Close()
db.Set(doc)
// Lookup the document
doc2, _ := NewDoc([]byte("key"), nil, nil)
defer doc2.Close()
db.Get(doc2)
// Delete the document
doc3, _ := NewDoc([]byte("key"), nil, nil)
defer doc3.Close()
db.Delete(doc3)