Crates.io | json-db |
lib.rs | json-db |
version | 0.1.2 |
source | src |
created_at | 2023-01-22 02:41:42.446942 |
updated_at | 2023-01-22 14:29:33.723576 |
description | Simple library for a document database saved on disk |
homepage | |
repository | |
max_upload_size | |
id | 764705 |
size | 18,773 |
Simple library for a document database saved on disk
let db = JsonDB::init("your db name")?;
// Create a collection
db.create_collection("your collection path")?;
// Write data to a document in a collection
db.write("your collection path", "your document", "struct that implements serde::Serialize")?;
// Read data from a document in a collection
let data: impl serde::Deserialize = db.read("your collection path", "your document")?;
// Delete document in a collection
db.delete("your collection path", "your document")?;
// List all document in a collection
let list: Vec<String> = db.list("your collection path")?