3 releases
0.1.2 | May 9, 2023 |
---|---|
0.1.1 | May 9, 2023 |
0.1.0 | May 9, 2023 |
#2949 in Database interfaces
17KB
349 lines
Amandine
Amandien is a tiny json database for Rust. It suits for embedded storage and client side storage.
Examples
lib.rs
:
Amandine
Amandine is a tiny json database for rust. It is designed to be used in small, embedded, or client-side projects.
Usage
use amandine::{Data, Database};
use serde::{Serialize, Deserialize};
use std::fs;
use std::path::Path;
#[derive(Serialize, Deserialize, Debug, Clone, Data)]
struct User {
name: String,
age: u8,
}
fn main() {
let db = Database::new();
let dbPath = Path::new("./db"); // should be folder/dir path
db.connect(dbPath.to_path_buf()).unwrap();
db.create_collection("users").unwrap(); // create a collection to store data
let user = User {
name: "John".to_string(),
age: 20,
}
db.insert("users", user).unwrap(); // insert data into collection
}
Dependencies
~2–11MB
~148K SLoC