struct

LMDB::AbstractCursor

Inherits Struct / Value / Object

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

Constructors

new(transaction : AbstractTransaction, database : Database)
Source

Instance methods

close

Close this cursor.

self must not be used after this call.

Source
readonly?

Whether self is a readonly cursor.

Source
to_unsafe
Source

Nested types