Struct idb_sys::ObjectStore
source · [−]pub struct ObjectStore { /* private fields */ }Expand description
Represents an object store in a database.
Implementations
sourceimpl 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
sourceimpl Clone for ObjectStore
impl Clone for ObjectStore
sourcefn clone(&self) -> ObjectStore
fn clone(&self) -> ObjectStore
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
sourceimpl Debug for ObjectStore
impl Debug for ObjectStore
sourceimpl From<IdbObjectStore> for ObjectStore
impl From<IdbObjectStore> for ObjectStore
sourcefn from(inner: IdbObjectStore) -> Self
fn from(inner: IdbObjectStore) -> Self
Converts to this type from the input type.
sourceimpl From<ObjectStore> for IdbObjectStore
impl From<ObjectStore> for IdbObjectStore
sourcefn from(object_store: ObjectStore) -> Self
fn from(object_store: ObjectStore) -> Self
Converts to this type from the input type.
sourceimpl From<ObjectStore> for JsValue
impl From<ObjectStore> for JsValue
sourcefn from(value: ObjectStore) -> Self
fn from(value: ObjectStore) -> Self
Converts to this type from the input type.
sourceimpl PartialEq<ObjectStore> for ObjectStore
impl PartialEq<ObjectStore> for ObjectStore
sourcefn eq(&self, other: &ObjectStore) -> bool
fn eq(&self, other: &ObjectStore) -> bool
This method tests for self and other values to be equal, and is used
by ==. Read more
sourcefn ne(&self, other: &ObjectStore) -> bool
fn ne(&self, other: &ObjectStore) -> bool
This method tests for !=.
sourceimpl TryFrom<JsValue> for ObjectStore
impl TryFrom<JsValue> for ObjectStore
impl Eq for ObjectStore
impl StructuralEq for ObjectStore
impl StructuralPartialEq for ObjectStore
Auto Trait Implementations
impl RefUnwindSafe for ObjectStore
impl !Send for ObjectStore
impl !Sync for ObjectStore
impl Unpin for ObjectStore
impl UnwindSafe for ObjectStore
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more