From e991375cadea32230d14a32da42796d6cafe6162 Mon Sep 17 00:00:00 2001 From: Mark Rushakoff Date: Sun, 22 Nov 2015 17:52:50 -0800 Subject: [PATCH 1/2] Explain iterating over sub-buckets in README --- README.md | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 80353ab..3c6f652 100644 --- a/README.md +++ b/README.md @@ -344,10 +344,15 @@ Next() Move to the next key. Prev() Move to the previous key. ``` -When you have iterated to the end of the cursor then `Next()` will return `nil`. -You must seek to a position using `First()`, `Last()`, or `Seek()` before -calling `Next()` or `Prev()`. If you do not seek to a position then these -functions will return `nil`. +Each of those functions has a return signature of `(key []byte, value []byte)`. +When you have iterated to the end of the cursor then `Next()` will return a +`nil` key. You must seek to a position using `First()`, `Last()`, or `Seek()` +before calling `Next()` or `Prev()`. If you do not seek to a position then +these functions will return a `nil` key. + +During iteration, if the key is non-`nil` but the value is `nil`, that means +the key refers to a bucket rather than a value. Use `Bucket.Bucket()` to +access the sub-bucket. #### Prefix scans From 9ee1aea61bf0874df1cacc0853660ad478dd68a0 Mon Sep 17 00:00:00 2001 From: Mark Rushakoff Date: Sun, 22 Nov 2015 17:53:11 -0800 Subject: [PATCH 2/2] Fix typo in comment --- tx.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tx.go b/tx.go index 3273106..d16f9f5 100644 --- a/tx.go +++ b/tx.go @@ -271,7 +271,7 @@ func (tx *Tx) close() { } // Copy writes the entire database to a writer. -// This function exists for backwards compatibility. Use WriteTo() in +// This function exists for backwards compatibility. Use WriteTo() instead. func (tx *Tx) Copy(w io.Writer) error { _, err := tx.WriteTo(w) return err