Struct idb_sys::ObjectStore
source · pub struct ObjectStore { /* private fields */ }Expand description
Represents an object store in a database.
Implementations§
source§impl ObjectStore
impl ObjectStore
sourcepub fn set_name(&self, name: &str)
pub fn set_name(&self, name: &str)
Updates the name of the store to newName. Returns and Error if not called within an upgrade transaction.
sourcepub fn index_names(&self) -> Vec<String>
pub fn index_names(&self) -> Vec<String>
Returns a list of the names of indexes in the store.
sourcepub fn transaction(&self) -> Transaction
pub fn transaction(&self) -> Transaction
Returns the associated Transaction.
sourcepub fn auto_increment(&self) -> bool
pub fn auto_increment(&self) -> bool
Returns true if the store has a key generator, and false otherwise.
sourcepub fn put(
&self,
value: &JsValue,
key: Option<&JsValue>
) -> Result<StoreRequest, Error>
pub fn put(
&self,
value: &JsValue,
key: Option<&JsValue>
) -> Result<StoreRequest, Error>
Adds or updates a record in store with the given value and key.
sourcepub fn add(
&self,
value: &JsValue,
key: Option<&JsValue>
) -> Result<StoreRequest, Error>
pub fn add(
&self,
value: &JsValue,
key: Option<&JsValue>
) -> Result<StoreRequest, Error>
Adds a record in store with the given value and key.
sourcepub fn delete(&self, query: impl Into<Query>) -> Result<StoreRequest, Error>
pub fn delete(&self, query: impl Into<Query>) -> Result<StoreRequest, Error>
Deletes records in store with the given key or in the given key range in query.
sourcepub fn clear(&self) -> Result<StoreRequest, Error>
pub fn clear(&self) -> Result<StoreRequest, Error>
Deletes all records in store.
sourcepub fn get(&self, query: impl Into<Query>) -> Result<StoreRequest, Error>
pub fn get(&self, query: impl Into<Query>) -> Result<StoreRequest, Error>
Retrieves the value of the first record matching the given key or key range in query.
sourcepub fn get_key(&self, query: impl Into<Query>) -> Result<StoreRequest, Error>
pub fn get_key(&self, query: impl Into<Query>) -> Result<StoreRequest, Error>
Retrieves the key of the first record matching the given key or key range in query.
sourcepub fn get_all(
&self,
query: Option<Query>,
limit: Option<u32>
) -> Result<StoreRequest, Error>
pub fn get_all(
&self,
query: Option<Query>,
limit: Option<u32>
) -> Result<StoreRequest, Error>
Retrieves the values of the records matching the given key or key range in query (up to limit if given).
sourcepub fn get_all_keys(
&self,
query: Option<Query>,
limit: Option<u32>
) -> Result<StoreRequest, Error>
pub fn get_all_keys(
&self,
query: Option<Query>,
limit: Option<u32>
) -> Result<StoreRequest, Error>
Retrieves the keys of records matching the given key or key range in query (up to limit if given).
sourcepub fn count(&self, query: Option<Query>) -> Result<StoreRequest, Error>
pub fn count(&self, query: Option<Query>) -> Result<StoreRequest, Error>
Retrieves the number of records matching the given key or key range in query.
sourcepub fn open_cursor(
&self,
query: Option<Query>,
cursor_direction: Option<CursorDirection>
) -> Result<StoreRequest, Error>
pub fn open_cursor(
&self,
query: Option<Query>,
cursor_direction: Option<CursorDirection>
) -> Result<StoreRequest, Error>
Opens a Cursor over the records matching query, ordered by direction. If query is None,
all records in store are matched.
sourcepub fn open_key_cursor(
&self,
query: Option<Query>,
cursor_direction: Option<CursorDirection>
) -> Result<StoreRequest, Error>
pub fn open_key_cursor(
&self,
query: Option<Query>,
cursor_direction: Option<CursorDirection>
) -> Result<StoreRequest, Error>
Opens a KeyCursor over the records matching query, ordered by direction. If query is
None, all records in store are matched.
sourcepub fn index(&self, name: &str) -> Result<Index, Error>
pub fn index(&self, name: &str) -> Result<Index, Error>
Returns an Index for the index named name in store.
sourcepub fn create_index(
&self,
name: &str,
key_path: KeyPath,
params: Option<IndexParams>
) -> Result<Index, Error>
pub fn create_index(
&self,
name: &str,
key_path: KeyPath,
params: Option<IndexParams>
) -> Result<Index, Error>
Trait Implementations§
source§impl Clone for ObjectStore
impl Clone for ObjectStore
source§fn clone(&self) -> ObjectStore
fn clone(&self) -> ObjectStore
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more