MCPcopy Index your code
hub / github.com/InfinitiBit/graphbit / new

Method new

core/src/memory/store.rs:25–34  ·  view source on GitHub ↗

Open (or create) the database at `db_path`. Pass `":memory:"` for an in-memory database.

(db_path: &str)

Source from the content-addressed store, hash-verified

23 /// Open (or create) the database at `db_path`.
24 /// Pass `":memory:"` for an in-memory database.
25 pub fn new(db_path: &str) -> GraphBitResult<Self> {
26 let conn = rusqlite::Connection::open(db_path)?;
27 // Enable foreign key enforcement (must be set per-connection).
28 conn.execute("PRAGMA foreign_keys = ON", [])?;
29 let store = Self {
30 conn: Arc::new(Mutex::new(conn)),
31 };
32 store.init_schema_sync()?;
33 Ok(store)
34 }
35
36 /// Create the required tables if they do not already exist.
37 fn init_schema_sync(&self) -> GraphBitResult<()> {

Callers

nothing calls this directly

Calls 2

init_schema_syncMethod · 0.80
executeMethod · 0.45

Tested by

no test coverage detected