pub struct Index<Err> { /* private fields */ }
Expand description
Implementations§
Source§impl<Err> Index<Err>
impl<Err> Index<Err>
Sourcepub fn contains(&self, key: &JsValue) -> impl Future<Output = Result<bool, Err>>
pub fn contains(&self, key: &JsValue) -> impl Future<Output = Result<bool, Err>>
Checks whether the provided key (for this index) already exists
Internally, this uses IDBIndex::count
.
Sourcepub fn count_in(
&self,
range: impl RangeBounds<JsValue>,
) -> impl Future<Output = Result<usize, Err>>
pub fn count_in( &self, range: impl RangeBounds<JsValue>, ) -> impl Future<Output = Result<usize, Err>>
Count all the keys (for this index) in the provided range
Internally, this uses IDBIndex::count
.
Sourcepub fn get(
&self,
key: &JsValue,
) -> impl Future<Output = Result<Option<JsValue>, Err>>
pub fn get( &self, key: &JsValue, ) -> impl Future<Output = Result<Option<JsValue>, Err>>
Get the object with key key
for this index
Internally, this uses IDBIndex::get
.
Sourcepub fn get_first_in(
&self,
range: impl RangeBounds<JsValue>,
) -> impl Future<Output = Result<Option<JsValue>, Err>>
pub fn get_first_in( &self, range: impl RangeBounds<JsValue>, ) -> impl Future<Output = Result<Option<JsValue>, Err>>
Get the first value with a key (for this index) in range
, ordered by key (for this index)
Note that the unbounded range is not a valid range for IndexedDB.
Internally, this uses IDBIndex::get
.
Sourcepub fn get_all(
&self,
limit: Option<u32>,
) -> impl Future<Output = Result<Vec<JsValue>, Err>>
pub fn get_all( &self, limit: Option<u32>, ) -> impl Future<Output = Result<Vec<JsValue>, Err>>
Get all the objects in the store, ordered by this index, with a maximum number of results of limit
Internally, this uses IDBIndex::getAll
.
Sourcepub fn get_all_in(
&self,
range: impl RangeBounds<JsValue>,
limit: Option<u32>,
) -> impl Future<Output = Result<Vec<JsValue>, Err>>
pub fn get_all_in( &self, range: impl RangeBounds<JsValue>, limit: Option<u32>, ) -> impl Future<Output = Result<Vec<JsValue>, Err>>
Get all the objects with a key (for this index) in the provided range, with a maximum number of
results of limit
, ordered by this index
Internally, this uses IDBIndex::getAll
.
Sourcepub fn get_first_key_in(
&self,
range: impl RangeBounds<JsValue>,
) -> impl Future<Output = Result<Option<JsValue>, Err>>
pub fn get_first_key_in( &self, range: impl RangeBounds<JsValue>, ) -> impl Future<Output = Result<Option<JsValue>, Err>>
Get the first existing primary key for an object that has a key (for this index) in the provided range
Internally, this uses IDBIndex::getKey
.
Sourcepub fn get_all_keys(
&self,
limit: Option<u32>,
) -> impl Future<Output = Result<Vec<JsValue>, Err>>
pub fn get_all_keys( &self, limit: Option<u32>, ) -> impl Future<Output = Result<Vec<JsValue>, Err>>
List all the primary keys in the object store, with a maximum number of results of limit
, ordered by this index
Internally, this uses IDBIndex::getAllKeys
.
Sourcepub fn get_all_keys_in(
&self,
range: impl RangeBounds<JsValue>,
limit: Option<u32>,
) -> impl Future<Output = Result<Vec<JsValue>, Err>>
pub fn get_all_keys_in( &self, range: impl RangeBounds<JsValue>, limit: Option<u32>, ) -> impl Future<Output = Result<Vec<JsValue>, Err>>
List all the primary keys of objects with a key (for this index)in the provided range, with a maximum number
of results of limit
, ordered by this index
Internally, this uses IDBIndex::getAllKeys
.
Sourcepub fn cursor(&self) -> CursorBuilder<Err>
pub fn cursor(&self) -> CursorBuilder<Err>
Open a Cursor
on this index