README.md
1# goforestdb
2
3Go bindings for ForestDB
4
5## Building
6
71. Obtain and build forestdb: https://github.com/couchbaselabs/forestdb (run `make install` to install the library)
81. Install header files to system location
9 1. On Ubuntu 14.04: `cd <forestdb_project_dir> && mkdir /usr/local/include/libforestdb && cp include/libforestdb/* /usr/local/include/libforestdb`
101. `go get -u -v -t github.com/couchbase/goforestdb`
11
12## Documentation
13
14See [godocs](http://godoc.org/github.com/couchbase/goforestdb)
15
16## Sample usage (without proper error handling):
17
18 // Open a database
19 db, _ := Open("test", nil)
20
21 // Close it properly when we're done
22 defer db.Close()
23
24 // Store the document
25 doc, _ := NewDoc([]byte("key"), nil, []byte("value"))
26 defer doc.Close()
27 db.Set(doc)
28
29 // Lookup the document
30 doc2, _ := NewDoc([]byte("key"), nil, nil)
31 defer doc2.Close()
32 db.Get(doc2)
33
34 // Delete the document
35 doc3, _ := NewDoc([]byte("key"), nil, nil)
36 defer doc3.Close()
37 db.Delete(doc3)
38