pub struct ObjectStore { /* private fields */ }
Expand description
Represents an object store in a database.
Implementations§
source§impl ObjectStore
impl ObjectStore
sourcepub fn builder(name: &str) -> ObjectStoreBuilder
Available on crate feature builder
only.
pub fn builder(name: &str) -> ObjectStoreBuilder
builder
only.Creates a new instance of ObjectStoreBuilder
.
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<PutStoreRequest, Error>
pub fn put( &self, value: &JsValue, key: Option<&JsValue>, ) -> Result<PutStoreRequest, Error>
Adds or updates a record in store with the given value and key.
sourcepub fn add(
&self,
value: &JsValue,
key: Option<&JsValue>,
) -> Result<AddStoreRequest, Error>
pub fn add( &self, value: &JsValue, key: Option<&JsValue>, ) -> Result<AddStoreRequest, Error>
Adds a record in store with the given value and key.
sourcepub fn delete(
&self,
query: impl Into<Query>,
) -> Result<DeleteStoreRequest, Error>
pub fn delete( &self, query: impl Into<Query>, ) -> Result<DeleteStoreRequest, Error>
Deletes records in store with the given key or in the given key range in query.
sourcepub fn clear(&self) -> Result<ClearStoreRequest, Error>
pub fn clear(&self) -> Result<ClearStoreRequest, Error>
Deletes all records in store.
sourcepub fn get(&self, query: impl Into<Query>) -> Result<GetStoreRequest, Error>
pub fn get(&self, query: impl Into<Query>) -> Result<GetStoreRequest, 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<GetKeyStoreRequest, Error>
pub fn get_key( &self, query: impl Into<Query>, ) -> Result<GetKeyStoreRequest, 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<GetAllStoreRequest, Error>
pub fn get_all( &self, query: Option<Query>, limit: Option<u32>, ) -> Result<GetAllStoreRequest, 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<GetAllKeysStoreRequest, Error>
pub fn get_all_keys( &self, query: Option<Query>, limit: Option<u32>, ) -> Result<GetAllKeysStoreRequest, 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<CountStoreRequest, Error>
pub fn count(&self, query: Option<Query>) -> Result<CountStoreRequest, 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<OpenCursorStoreRequest, Error>
pub fn open_cursor( &self, query: Option<Query>, cursor_direction: Option<CursorDirection>, ) -> Result<OpenCursorStoreRequest, 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<OpenKeyCursorStoreRequest, Error>
pub fn open_key_cursor( &self, query: Option<Query>, cursor_direction: Option<CursorDirection>, ) -> Result<OpenKeyCursorStoreRequest, 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<IdbObjectStore> for ObjectStore
impl From<IdbObjectStore> for ObjectStore
source§fn from(inner: IdbObjectStore) -> Self
fn from(inner: IdbObjectStore) -> Self
source§impl From<ObjectStore> for IdbObjectStore
impl From<ObjectStore> for IdbObjectStore
source§fn from(object_store: ObjectStore) -> Self
fn from(object_store: ObjectStore) -> Self
source§impl From<ObjectStore> for JsValue
impl From<ObjectStore> for JsValue
source§fn from(value: ObjectStore) -> Self
fn from(value: ObjectStore) -> Self
source§impl PartialEq for ObjectStore
impl PartialEq for ObjectStore
source§impl TryFrom<JsValue> for ObjectStore
impl TryFrom<JsValue> for ObjectStore
impl Eq for ObjectStore
impl StructuralPartialEq for ObjectStore
Auto Trait Implementations§
impl Freeze for ObjectStore
impl RefUnwindSafe for ObjectStore
impl !Send for ObjectStore
impl !Sync for ObjectStore
impl Unpin for ObjectStore
impl UnwindSafe for ObjectStore
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)