MCPcopy
hub / github.com/etcd-io/bbolt / Prev

Method Prev

cursor.go:107–114  ·  view source on GitHub ↗

Prev moves the cursor to the previous item in the bucket and returns its key and value. If the cursor is at the beginning 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.

()

Source from the content-addressed store, hash-verified

105// If the cursor is at the beginning of the bucket then a nil key and value are returned.
106// The returned key and value are only valid for the life of the transaction.
107func (c *Cursor) Prev() (key []byte, value []byte) {
108 common.Assert(c.bucket.tx.db != nil, "tx closed")
109 k, v, flags := c.prev()
110 if (flags & uint32(common.BucketLeafFlag)) != 0 {
111 return k, nil
112 }
113 return k, v
114}
115
116// Seek moves the cursor to a given key using a b-tree search and returns it.
117// If the key does not exist then the next key is used. If no keys

Calls 2

prevMethod · 0.95
AssertFunction · 0.92