abstract struct LMDB::AbstractCursor
- LMDB::AbstractCursor
- Struct
- Value
- Object
Overview
A Cursor
points to records in a database, and is used to iterate through
the records in a Database
.
Cursors are created in the context of a Transaction
, and should only be
used as long as that transaction is active. In other words, after a
Transaction#commit
or Transaction#abort
, the cursors created while
that transaction was active are no longer usable.
To create a cursor, see Database#cursor
.
Example:
LMDB.open "databasedir" do |env|
env.database "databasename" do |db|
db.cursor do |cursor|
r1 = cursor.last # => content of the last record
r2 = cursor.first # => content of the first record
key, _ = cursor.next # => content of the second record
cursor.put key, "newval" # => replace the value of last record
end
end
end
Direct Known Subclasses
Defined in:
lmdb/cursor.crConstructors
Instance Method Summary
-
#close
Close this cursor.
-
#readonly? : Bool
Whether
self
is a readonly cursor. - #to_unsafe : Pointer(Void)