pub struct Database<Err> { /* private fields */ }
Expand description
Wrapper for IDBDatabase
Implementations§
Source§impl<Err> Database<Err>
impl<Err> Database<Err>
Sourcepub fn name(&self) -> String
pub fn name(&self) -> String
The name of this database
Internally, this uses IDBDatabase::name
.
Sourcepub fn version(&self) -> u32
pub fn version(&self) -> u32
The version of this database, clamped at u32::MAX
Internally, this uses IDBDatabase::version
.
Sourcepub fn object_store_names(&self) -> Vec<String>
pub fn object_store_names(&self) -> Vec<String>
The names of all ObjectStore
s in this Database
Internally, this uses IDBDatabase::objectStoreNames
.
Sourcepub fn build_object_store<'a>(
&self,
name: &'a str,
) -> ObjectStoreBuilder<'a, Err>
pub fn build_object_store<'a>( &self, name: &'a str, ) -> ObjectStoreBuilder<'a, Err>
Build an ObjectStore
Note that this method can only be called from within an on_upgrade_needed
callback. It returns
a builder, and calling the create
method on this builder will perform the actual creation.
Internally, this uses IDBDatabase::createObjectStore
.
Sourcepub fn delete_object_store(&self, name: &str) -> Result<(), Err>
pub fn delete_object_store(&self, name: &str) -> Result<(), Err>
Deletes an ObjectStore
Note that this method can only be called from within an on_upgrade_needed
callback.
Internally, this uses IDBDatabase::deleteObjectStore
.
Sourcepub fn transaction(&self, stores: &[&str]) -> TransactionBuilder<Err>
pub fn transaction(&self, stores: &[&str]) -> TransactionBuilder<Err>
Run a transaction
This will open the object stores identified by stores
. See the methods of TransactionBuilder
for more details about how transactions actually happen.
Sourcepub fn close(&self)
pub fn close(&self)
Closes this database connection
Note that the closing will actually happen asynchronously with no way for the client to identify when the database was closed.
Internally, this uses IDBDatabase::close
.