Details
-
Bug
-
Resolution: Unresolved
-
Major
-
6.5.0
-
None
-
Untriaged
-
Unknown
Description
Problem
The start out guide to goforestdb is incorrect:
https://godoc.org/github.com/couchbase/goforestdb
The following error is produce:
./main.go:12:7: db.Set undefined (type *forestdb.File has no field or method Set)
|
Steps to reproduce
- Copy the code from the documentation
- Execute the code
Workaround
The following works
package main
|
|
import "github.com/couchbase/goforestdb"
|
|
func main() {
|
// Open a database
|
db, _ := forestdb.Open("test.fdb", nil)
|
// Close it properly when we're done
|
defer db.Close()
|
|
// Open a Key Value store
|
kvs, _ := db.OpenKVStore("kvs-01", nil)
|
defer kvs.Close()
|
|
// Store the document
|
doc, _ := forestdb.NewDoc([]byte("key"), nil, []byte("value"))
|
defer doc.Close()
|
kvs.Set(doc)
|
|
// Lookup the document
|
doc2, _ := forestdb.NewDoc([]byte("key"), nil, nil)
|
defer doc2.Close()
|
kvs.Get(doc2)
|
|
// Delete the document
|
doc3, _ := forestdb.NewDoc([]byte("key"), nil, nil)
|
defer doc3.Close()
|
kvs.Delete(doc3)
|
}
|