pub struct Database { /* private fields */ }Expand description
Implementations
sourceimpl 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
sourceimpl From<Database> for IdbDatabase
impl From<Database> for IdbDatabase
sourceimpl From<IdbDatabase> for Database
impl From<IdbDatabase> for Database
sourcefn from(inner: IdbDatabase) -> Self
fn from(inner: IdbDatabase) -> Self
Converts to this type from the input type.
sourceimpl TryFrom<EventTarget> for Database
impl TryFrom<EventTarget> for Database
Auto Trait Implementations
impl !RefUnwindSafe for Database
impl !Send for Database
impl !Sync for Database
impl Unpin for Database
impl !UnwindSafe for Database
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
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