From 8e8fc692b32162a67f8881ede88444f116c0a1c8 Mon Sep 17 00:00:00 2001 From: Alessandro Date: Thu, 11 Jul 2024 16:30:02 +0200 Subject: [PATCH] changes in pebbleDBIterator Value() impl: - returns the value itself, not a copy - updated docs to reflect the change --- pebble.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pebble.go b/pebble.go index ddb1814..ed8f21a 100644 --- a/pebble.go +++ b/pebble.go @@ -397,18 +397,18 @@ func (itr *pebbleDBIterator) Valid() bool { // Key implements Iterator. // The caller should not modify the contents of the returned slice. -// To work with the slice, make a copy and modify the copy instead. +// Instead, the caller should make a copy and work on the copy. func (itr *pebbleDBIterator) Key() []byte { itr.assertIsValid() return itr.source.Key() } // 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 *pebbleDBIterator) Value() []byte { - // Value returns a copy of the current value. - // See https://github.com/cockroachdb/pebble/blob/v1.0.0/iterator.go#L2116 itr.assertIsValid() - return cp(itr.source.Value()) + return itr.source.Value() } // Next implements Iterator.