pub struct Database { /* private fields */ }
Expand description
Implementations§
Source§impl Database
impl Database
Sourcepub fn builder(name: &str) -> DatabaseBuilder
Available on crate feature builder
only.
pub fn builder(name: &str) -> DatabaseBuilder
builder
only.Creates a new instance of DatabaseBuilder
.
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.
Sourcepub fn forget_callbacks(&mut self)
pub fn forget_callbacks(&mut self)
Release memory management of the callbacks to JS GC.
Note: This may leak memory. Read more about it here.
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 Freeze for Database
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