MCPcopy Create free account
hub / github.com/SeaQL/FireDBG.for.Rust / reopen

Method reopen

indexer/src/database.rs:38–48  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

36 }
37
38 pub async fn reopen(&mut self) -> Result<(), DbErr> {
39 // Close existing db, if any
40 if let Some(db) = self.db.take() {
41 db.close().await?; // drop it
42 }
43 let mut opt = ConnectOptions::new(format!("sqlite://{}", self.path));
44 opt.max_connections(1).sqlx_logging(false);
45 let db = SeaDatabase::connect(opt).await?;
46 self.db = Some(db);
47 Ok(())
48 }
49
50 pub fn db(&self) -> &DbConn {
51 self.db.as_ref().expect("DB closed")

Callers 1

batchMethod · 0.80

Calls 1

closeMethod · 0.45

Tested by

no test coverage detected