Rebase fix + Started writing the real SQL we're going to need
This commit is contained in:
parent
e5c6393f85
commit
500ecbf915
8 changed files with 109 additions and 81 deletions
22
crates/db/examples/serialize_workspace.rs
Normal file
22
crates/db/examples/serialize_workspace.rs
Normal file
|
@ -0,0 +1,22 @@
|
|||
use std::{fs::File, path::Path};
|
||||
|
||||
const TEST_FILE: &'static str = "test-db.db";
|
||||
|
||||
fn main() -> anyhow::Result<()> {
|
||||
let db = db::Db::open_in_memory();
|
||||
if db.real().is_none() {
|
||||
return Err(anyhow::anyhow!("Migrations failed"));
|
||||
}
|
||||
let file = Path::new(TEST_FILE);
|
||||
|
||||
let f = File::create(file)?;
|
||||
drop(f);
|
||||
|
||||
db.write_kvp("test", "1")?;
|
||||
db.write_kvp("test", "2")?;
|
||||
db.write_to(file).ok();
|
||||
|
||||
println!("Wrote database!");
|
||||
|
||||
Ok(())
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue