Skip to content

Commit

Permalink
updated boltDB Iterator APIs to conform to the changes made in #168
Browse files Browse the repository at this point in the history
  • Loading branch information
alesforz committed Aug 9, 2024
1 parent 295578b commit e377c94
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions boltdb_iterator.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,19 +110,19 @@ func (itr *boltDBIterator) Next() {
}

// Key implements Iterator.
// The caller should not modify the contents of the returned slice.
// Instead, the caller should make a copy and work on the copy.
func (itr *boltDBIterator) Key() []byte {
itr.assertIsValid()
return append([]byte{}, itr.currentKey...)
return itr.currentKey
}

// Value implements Iterator.
// The caller should not modify the contents of the returned slice.
// Instead, the caller should make a copy and work on the copy.
func (itr *boltDBIterator) Value() []byte {
itr.assertIsValid()
var value []byte
if itr.currentValue != nil {
value = append([]byte{}, itr.currentValue...)
}
return value
return itr.currentValue
}

// Error implements Iterator.
Expand Down

0 comments on commit e377c94

Please sign in to comment.