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 ObjectStore
s in the database.
sourcepub fn transaction<T>(
&self,
store_names: &[T],
mode: TransactionMode
) -> Result<Transaction, Error>
pub fn transaction<T>( &self, store_names: &[T], mode: TransactionMode ) -> Result<Transaction, Error>
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_version_change<F>(&mut self, callback: F)
pub fn on_version_change<F>(&mut self, callback: F)
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.
source§impl 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§
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
Mutably borrows from an owned value. Read more