pub struct Cursor { /* private fields */ }
Expand description
Represents a cursor for traversing or iterating over multiple records in a database.
Implementations§
source§impl Cursor
impl Cursor
sourcepub fn source(&self) -> Object
pub fn source(&self) -> Object
Returns the ObjectStore
or Index
the cursor was opened from.
sourcepub fn direction(&self) -> Result<CursorDirection, Error>
pub fn direction(&self) -> Result<CursorDirection, Error>
Returns the direction of the cursor.
sourcepub fn key(&self) -> Result<JsValue, Error>
pub fn key(&self) -> Result<JsValue, Error>
Returns the key of the cursor. Returns an Error
if the cursor is advancing or is finished.
sourcepub fn primary_key(&self) -> Result<JsValue, Error>
pub fn primary_key(&self) -> Result<JsValue, Error>
Returns the effective key of the cursor. Returns an Error
if the cursor is advancing or is finished.
sourcepub fn value(&self) -> Result<JsValue, Error>
pub fn value(&self) -> Result<JsValue, Error>
Returns the cursor’s current value. Returns an Error
if the cursor is advancing or is finished.
sourcepub fn request(&self) -> StoreRequest
pub fn request(&self) -> StoreRequest
Returns the StoreRequest
that was used to obtain this cursor.
sourcepub fn advance(&self, count: u32) -> Result<(), Error>
pub fn advance(&self, count: u32) -> Result<(), Error>
Advances the cursor through the next count records in range.
sourcepub fn next(&self, key: Option<&JsValue>) -> Result<(), Error>
pub fn next(&self, key: Option<&JsValue>) -> Result<(), Error>
Advances the cursor to the next record in range matching or after key (if provided).
sourcepub fn update(&self, value: &JsValue) -> Result<StoreRequest, Error>
pub fn update(&self, value: &JsValue) -> Result<StoreRequest, Error>
Updated the record pointed at by the cursor with a new value.
sourcepub fn delete(&self) -> Result<StoreRequest, Error>
pub fn delete(&self) -> Result<StoreRequest, Error>
Delete the record pointed at by the cursor with a new value.