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

Method create

indexer/src/database.rs:27–36  ·  view source on GitHub ↗
(path: String)

Source from the content-addressed store, hash-verified

25
26impl Database {
27 pub async fn create(path: String) -> Result<Self, DbErr> {
28 AsyncFile::new_ow(path.parse().expect("UrlErr")) // overwrite the file
29 .await
30 .expect("File System Error");
31 let mut opt = ConnectOptions::new(format!("sqlite://{path}?mode=rw"));
32 opt.max_connections(1).sqlx_logging(false);
33 let db = SeaDatabase::connect(opt).await?;
34 create_tables(&db).await?;
35 Ok(Self { path, db: Some(db) })
36 }
37
38 pub async fn reopen(&mut self) -> Result<(), DbErr> {
39 // Close existing db, if any

Callers

nothing calls this directly

Calls 2

create_tablesFunction · 0.85
parseMethod · 0.80

Tested by

no test coverage detected