Next moves the cursor to the next item in the bucket and returns its key and value. If the cursor is at the end of the bucket then a nil key and value are returned. The returned key and value are only valid for the life of the transaction.
()
| 93 | // If the cursor is at the end of the bucket then a nil key and value are returned. |
| 94 | // The returned key and value are only valid for the life of the transaction. |
| 95 | func (c *Cursor) Next() (key []byte, value []byte) { |
| 96 | common.Assert(c.bucket.tx.db != nil, "tx closed") |
| 97 | k, v, flags := c.next() |
| 98 | if (flags & uint32(common.BucketLeafFlag)) != 0 { |
| 99 | return k, nil |
| 100 | } |
| 101 | return k, v |
| 102 | } |
| 103 | |
| 104 | // Prev moves the cursor to the previous item in the bucket and returns its key and value. |
| 105 | // If the cursor is at the beginning of the bucket then a nil key and value are returned. |