diff --git a/Cargo.lock b/Cargo.lock index b195356..03f9982 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -102,7 +102,7 @@ checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440" [[package]] name = "j_db" -version = "0.1.0" +version = "0.1.1" dependencies = [ "byteorder", "json", diff --git a/Cargo.toml b/Cargo.toml index e6a7c24..9e747cc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "j_db" -version = "0.1.0" +version = "0.1.1" authors = ["Joey Hines "] edition = "2021" description = "A good enough (TM) embedded Rust DB* and ORM*" diff --git a/src/database.rs b/src/database.rs index 775e181..a5d68a1 100644 --- a/src/database.rs +++ b/src/database.rs @@ -217,6 +217,7 @@ impl Database { } pub fn import_db(&self, json: JsonValue) -> Result<()> { + self.db.clear()?; for model in json["global"].members() { let id_bytes = model["id"].as_u64().unwrap().to_be_bytes(); self.db.insert(id_bytes, model.to_string().as_bytes())?;