ForEach invokes the passed function with every key/value pair in the bucket. This does not include nested buckets or the key/value pairs within those nested buckets.

WARNING: It is not safe to mutate data while iterating with this method. Doing so may cause the underlying cursor to be invalidated and return unexpected keys and/or values.

The interface contract guarantees at least the following errors will be returned (other implementation-specific errors are possible):

- ErrTxClosed if the transaction has already been closed

NOTE: The slices returned by this function are only valid during a transaction. Attempting to access them after a transaction has ended results in undefined behavior. Additionally, the slices must NOT be modified by the caller. These constraints prevent additional data copies and allows support for memory-mapped database implementations.

ForEach is referenced in 2 repositories