Open sunface opened 6 years ago
+1
+1
I will try to contribute some worked examples of different use cases, having just spent a few hours going through the Go API this evening. No ETA though, so if someone else gets there first, then great! :-)
+1
would appreciate a watch sample. I have a fairly nice one, but it only runs for few dozen watches and then bombs with FoundationDB error code 1009 (Request for future version).
One thing that wasn't clear to me when starting out with FDB was that transaction timeouts are on a per-transaction basis. The docs don't set them and I think they should. Here's an example of checking whether or not a key exists w/ timeouts:
var exists bool
keyToFind := "testing-key"
ret, err := db.Transact(func(tr fdb.Transaction) (interface{}, error) {
tr.Options().SetTimeout(2000) // Set a 2 second timeout (you may want less)
if tr.Get(fdb.Key(keyToFind)).MustGet() != nil {
return true, nil
}
return false, nil
})
if err != nil {
log.Printf("Error checking FDB for key: %v", err)
}
exists = ret.(bool)
The docs don't set them and I think they should.
The docs don't set them and I think they should.
See also #882
Thanks AJ. Added a pull request to add them to the docs (at least for python and golang)
need some go examples
see the code comments below
so, please add more examples of tuples range and offset ,thans very much : )