Struct idb::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 async fn put(
&self,
value: &JsValue,
key: Option<&JsValue>
) -> Result<JsValue, Error>
pub async fn put(
&self,
value: &JsValue,
key: Option<&JsValue>
) -> Result<JsValue, Error>
Adds or updates a record in store with the given value and key.
sourcepub async fn add(
&self,
value: &JsValue,
key: Option<&JsValue>
) -> Result<JsValue, Error>
pub async fn add(
&self,
value: &JsValue,
key: Option<&JsValue>
) -> Result<JsValue, Error>
Adds a record in store with the given value and key.
sourcepub async fn delete(&self, query: impl Into<Query>) -> Result<(), Error>
pub async fn delete(&self, query: impl Into<Query>) -> Result<(), Error>
Deletes records in store with the given key or in the given key range in query.
sourcepub async fn get(
&self,
query: impl Into<Query>
) -> Result<Option<JsValue>, Error>
pub async fn get(
&self,
query: impl Into<Query>
) -> Result<Option<JsValue>, Error>
Retrieves the value of the first record matching the given key or key range in query.
sourcepub async fn get_key(
&self,
query: impl Into<Query>
) -> Result<Option<JsValue>, Error>
pub async fn get_key(
&self,
query: impl Into<Query>
) -> Result<Option<JsValue>, Error>
Retrieves the key of the first record matching the given key or key range in query.
sourcepub async fn get_all(
&self,
query: Option<Query>,
limit: Option<u32>
) -> Result<Vec<JsValue>, Error>
pub async fn get_all(
&self,
query: Option<Query>,
limit: Option<u32>
) -> Result<Vec<JsValue>, Error>
Retrieves the values of the records matching the given key or key range in query (up to limit if given).
sourcepub async fn get_all_keys(
&self,
query: Option<Query>,
limit: Option<u32>
) -> Result<Vec<JsValue>, Error>
pub async fn get_all_keys(
&self,
query: Option<Query>,
limit: Option<u32>
) -> Result<Vec<JsValue>, Error>
Retrieves the keys of records matching the given key or key range in query (up to limit if given).
sourcepub async fn count(&self, query: Option<Query>) -> Result<u32, Error>
pub async fn count(&self, query: Option<Query>) -> Result<u32, Error>
Retrieves the number of records matching the given key or key range in query.
sourcepub async fn open_cursor(
&self,
query: Option<Query>,
cursor_direction: Option<CursorDirection>
) -> Result<Option<Cursor>, Error>
pub async fn open_cursor(
&self,
query: Option<Query>,
cursor_direction: Option<CursorDirection>
) -> Result<Option<Cursor>, Error>
Opens a Cursor over the records matching query, ordered by direction. If query is None,
all records in store are matched.
sourcepub async fn open_key_cursor(
&self,
query: Option<Query>,
cursor_direction: Option<CursorDirection>
) -> Result<Option<KeyCursor>, Error>
pub async fn open_key_cursor(
&self,
query: Option<Query>,
cursor_direction: Option<CursorDirection>
) -> Result<Option<KeyCursor>, 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 moresource§impl Debug for ObjectStore
impl Debug for ObjectStore
source§impl From<ObjectStore> for JsValue
impl From<ObjectStore> for JsValue
source§fn from(value: ObjectStore) -> Self
fn from(value: ObjectStore) -> Self
source§impl From<ObjectStore> for ObjectStore
impl From<ObjectStore> for ObjectStore
source§fn from(inner: SysObjectStore) -> Self
fn from(inner: SysObjectStore) -> Self
source§impl From<ObjectStore> for SysObjectStore
impl From<ObjectStore> for SysObjectStore
source§fn from(object_store: ObjectStore) -> Self
fn from(object_store: ObjectStore) -> Self
source§impl PartialEq<ObjectStore> for ObjectStore
impl PartialEq<ObjectStore> for ObjectStore
source§fn eq(&self, other: &ObjectStore) -> bool
fn eq(&self, other: &ObjectStore) -> bool
self and other values to be equal, and is used
by ==.