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 more