aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Tarasiewicz <philipp.tarasiewicz@googlemail.com>2015-01-18 16:39:15 +0100
committerPhilipp Tarasiewicz <philipp.tarasiewicz@googlemail.com>2015-01-18 16:39:15 +0100
commite238914be852d54c79d06a53ab7ab88b82f3a7f7 (patch)
treed21027f7d3a0b35befa2656cc0d32742d3c705d1
parentMerge pull request #283 from mbertschler/master (diff)
downloaddedo-e238914be852d54c79d06a53ab7ab88b82f3a7f7.tar.gz
dedo-e238914be852d54c79d06a53ab7ab88b82f3a7f7.tar.xz
fix 'range scans' example
Due to the fact that you want to iterate over all keys that are before or equal to `max` starting from `min` the bytes.Compare() check should look like the commit suggests.
-rw-r--r--README.md2
1 files changed, 1 insertions, 1 deletions
diff --git a/README.md b/README.md
index 66b8ddb..4b5c63f 100644
--- a/README.md
+++ b/README.md
@@ -288,7 +288,7 @@ db.View(func(tx *bolt.Tx) error {
max := []byte("2000-01-01T00:00:00Z")
// Iterate over the 90's.
- for k, v := c.Seek(min); k != nil && bytes.Compare(k, max) != -1; k, v = c.Next() {
+ for k, v := c.Seek(min); k != nil && bytes.Compare(k, max) <= 0; k, v = c.Next() {
fmt.Printf("%s: %s\n", k, v)
}