#document-database #disk #collection #saved #write #db #read

json-db

Simple library for a document database saved on disk

2 releases

0.1.2 Jan 22, 2023
0.1.1 Jan 22, 2023
0.1.0 Jan 22, 2023

#1785 in Database interfaces

Apache-2.0

8KB
143 lines

json-db

Simple library for a document database saved on disk

Usage

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")?

Dependencies

~0.7–1.6MB
~36K SLoC