sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
On This Page
Manual iterators.
A cursor allows to iterates manually on the database. A cursor may be read-only or read-write.
go txn f
makes a cursor in the transaction txn
using the function f
.
The function f
will receive the cursor. A cursor can only be create and used inside a transaction. The cursor inherits the permissions of the transaction. The cursor should not be leaked outside of f
.
Here is an example that returns the first 5 elements of a database:
go txn begin fun c ->
let h = first c in
let rec aux i =
if i < 5 then next c :: aux (i+1)
else []
in
h :: aux 1
end
val put : ?flags:PutFlags.t -> [> `Write ] t -> key -> elt -> unit
put cursor k v
adds k,v
to the database and move the cursor to its position.
val put_here : ?flags:PutFlags.t -> [> `Write ] t -> key -> elt -> unit
put_here cursor k v
adds k,v
at the current position.
val remove : ?all:bool -> [> `Write ] t -> unit
remove cursor
removes the current binding.
If the database allow duplicate keys and if all
is true
, removes all the bindings associated to the current key.
seek_range cursor k
moves the cursor to the first key greater or equal to k
.
Similar to the previous operations, but only inside a set of binding sharing the same key.
Raise Invalid_argument
if used on a database that does not support duplicate keys.