From 5f1bc4f2807614dca1ac84136a5c355fde65543a Mon Sep 17 00:00:00 2001 From: cel 🌸 Date: Thu, 8 May 2025 10:18:07 +0100 Subject: feat(filamento): OPFS FileStore implementation --- filamento/src/db.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'filamento/src/db.rs') diff --git a/filamento/src/db.rs b/filamento/src/db.rs index d2c24a2..e560443 100644 --- a/filamento/src/db.rs +++ b/filamento/src/db.rs @@ -54,10 +54,22 @@ impl Db { }) } + #[cfg(target_arch = "wasm32")] + pub async fn create_connect_and_migrate_memory() -> Result { + let db = Connection::open("mem.db")?; + db.execute_batch(include_str!("../migrations/1.sql"))?; + Ok(Self { + db: Arc::new(Mutex::new(db)), + }) + } + #[cfg(target_arch = "wasm32")] pub async fn create_connect_and_migrate( path: impl AsRef, ) -> Result { + // rusqlite::ffi::install_opfs_sahpool(Some(&rusqlite::ffi::OpfsSAHPoolCfg::default()), true) + // .await + // .unwrap(); let db = Connection::open(path)?; db.execute_batch(include_str!("../migrations/1.sql"))?; Ok(Self { -- cgit