Struct indexed_db::Factory
source · pub struct Factory { /* private fields */ }
Expand description
Wrapper for IDBFactory
Implementations§
source§impl Factory
impl Factory
sourcepub fn get() -> Result<Factory>
pub fn get() -> Result<Factory>
Retrieve the global Factory
from the browser
This internally uses indexedDB
.
sourcepub fn cmp(&self, lhs: &JsValue, rhs: &JsValue) -> Result<Ordering>
pub fn cmp(&self, lhs: &JsValue, rhs: &JsValue) -> Result<Ordering>
Compare two keys for ordering
Returns an error if one of the two values would not be a valid IndexedDb key.
This internally uses IDBFactory::cmp
.
sourcepub async fn delete_database(&self, name: &str) -> Result<()>
pub async fn delete_database(&self, name: &str) -> Result<()>
Delete a database
Returns an error if something failed during the deletion. Note that trying to delete a database that does not exist will result in a successful result.
This internally uses IDBFactory::deleteDatabase
sourcepub async fn open(
&self,
name: &str,
version: u32,
upgrader: impl 'static + FnOnce(VersionChangeEvent) -> Result<()>
) -> Result<Database>
pub async fn open( &self, name: &str, version: u32, upgrader: impl 'static + FnOnce(VersionChangeEvent) -> Result<()> ) -> Result<Database>
Open a database
Returns an error if something failed while opening or upgrading the database. Blocks until it can actually open the database.
Note that version
must be at least 1
. upgrader
will be called when version
is higher than the previous
database version, or upon database creation.
This internally uses IDBFactory::open
as well as the methods from IDBOpenDBRequest