Next: Index Cursor API, Previous: BTree API, Up: User API Reference
Cursors are objects of type cursor (see Class elephant:cursor) which provide methods for complex traversals of BTrees.
Macro which opens a named cursor on a BTree (primary or not), evaluates the forms, then closes the cursor.
Close the cursor. Make sure to close cursors before the enclosing transaction is closed!
Each of the following methods return multiple values consisting of
(exists? key value)
.
Get the key / value at the cursor position. Returns has-pair key value, where has-pair is a boolean indicating there was a pair.
Move the cursor to the beginning of the BTree, returning has-pair key value.
Move the cursor to the end of the BTree, returning has-pair key value.
Move the cursor to a particular key, returning has-pair key value.
Move the cursor to the first key-value pair with key greater or equal to the key argument, according to the lisp sorter. Returns has-pair key value.
Moves the cursor to a particular key / value pair, returning has-pair key value.
Moves the cursor to the first key / value pair with key equal to the key argument and value greater or equal to the value argument. Not really useful for us since primaries don't have duplicates. Returns has-pair key value.