pub struct Database { /* private fields */ }Expand description
Implementations§
source§impl Database
impl Database
sourcepub fn store_names(&self) -> Vec<String>
pub fn store_names(&self) -> Vec<String>
Returns a list of the names of ObjectStores in the database.
sourcepub fn transaction<T>(
&self,
store_names: &[T],
mode: TransactionMode
) -> Result<Transaction, Error>where
T: AsRef<str>,
pub fn transaction<T>(
&self,
store_names: &[T],
mode: TransactionMode
) -> Result<Transaction, Error>where
T: AsRef<str>,
Returns a new transaction with the given scope (which can be a single object store name or an array of names),
mode (TransactionMode::ReadOnly or TransactionMode::ReadWrite).
sourcepub fn create_object_store(
&self,
name: &str,
params: ObjectStoreParams
) -> Result<ObjectStore, Error>
pub fn create_object_store(
&self,
name: &str,
params: ObjectStoreParams
) -> Result<ObjectStore, Error>
Creates a new object store with the given name and options and returns a new ObjectStore. Returns an
Error if not called within an upgrade transaction.
sourcepub fn delete_object_store(&self, name: &str) -> Result<(), Error>
pub fn delete_object_store(&self, name: &str) -> Result<(), Error>
Deletes the object store with the given name. Returns an Error if not called within an upgrade transaction.
sourcepub fn on_abort<F>(&mut self, callback: F)where
F: FnOnce(Event) + 'static,
pub fn on_abort<F>(&mut self, callback: F)where
F: FnOnce(Event) + 'static,
Adds an event handler for abort event.
sourcepub fn on_close<F>(&mut self, callback: F)where
F: FnOnce(Event) + 'static,
pub fn on_close<F>(&mut self, callback: F)where
F: FnOnce(Event) + 'static,
Adds an event handler for close event.
sourcepub fn on_error<F>(&mut self, callback: F)where
F: FnOnce(Event) + 'static,
pub fn on_error<F>(&mut self, callback: F)where
F: FnOnce(Event) + 'static,
Adds an event handler for error event.
sourcepub fn on_version_change<F>(&mut self, callback: F)where
F: FnOnce(Event) + 'static,
pub fn on_version_change<F>(&mut self, callback: F)where
F: FnOnce(Event) + 'static,
Adds an event handler for versionchange event.
Trait Implementations§
source§impl From<Database> for IdbDatabase
impl From<Database> for IdbDatabase
source§impl From<IdbDatabase> for Database
impl From<IdbDatabase> for Database
source§fn from(inner: IdbDatabase) -> Self
fn from(inner: IdbDatabase) -> Self
Converts to this type from the input type.