mirror of https://github.com/etcd-io/bbolt.git
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.pull/34/head
parent
15a58b04ae
commit
e238914be8
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue