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

Method keyValue

cursor.go:370–387  ·  view source on GitHub ↗

keyValue returns the key and value of the current leaf element.

()

Source from the content-addressed store, hash-verified

368
369// keyValue returns the key and value of the current leaf element.
370func (c *Cursor) keyValue() ([]byte, []byte, uint32) {
371 ref := &c.stack[len(c.stack)-1]
372
373 // If the cursor is pointing to the end of page/node then return nil.
374 if ref.count() == 0 || ref.index >= ref.count() {
375 return nil, nil, 0
376 }
377
378 // Retrieve value from node.
379 if ref.node != nil {
380 inode := &ref.node.inodes[ref.index]
381 return inode.Key(), inode.Value(), inode.Flags()
382 }
383
384 // Or retrieve value from page.
385 elem := ref.page.LeafPageElement(uint16(ref.index))
386 return elem.Key(), elem.Value(), elem.Flags()
387}
388
389// node returns the node that the cursor is currently positioned on.
390func (c *Cursor) node() *node {

Callers 6

firstMethod · 0.95
LastMethod · 0.95
DeleteMethod · 0.95
seekMethod · 0.95
nextMethod · 0.95
prevMethod · 0.95

Calls 5

countMethod · 0.80
LeafPageElementMethod · 0.80
KeyMethod · 0.45
ValueMethod · 0.45
FlagsMethod · 0.45

Tested by

no test coverage detected