hotpot-db
The 🌶🌶🌶 hottest way to store data
hotpot-db is a spicy, incredibly easy to use, and delcious database system.
What in the pot?
- schemaless
- reliable (uses SQLite3)
- embeddable
- fast
- JSON store
- queryable JSON schemas
use hotpot_db::*;
use serde::{Deserialize, Serialize};
#[derive(Debug, Serialize, Deserialize)]
struct Person {
name: String,
age: u32,
}
#[derive(Serialize, Deserialize)]
struct Grade {
assignment: String,
score: f32,
person: Person,
}
fn main() -> Result<(), hotpot_db::Error> {
let mut pot = HotPot::new();
pot.create_collection("address_book")?;
let grade = Grade {
assignment: String::from("First Test"),
score: 90.25,
person: Person {
name: String::from("drbh"),
age: 101,
},
};
let json_to_store = serde_json::to_string(&grade).unwrap();
pot.add_object_to_collection("address_book", json_to_store)?;
let grade = Grade {
assignment: String::from("First Test"),
score: 290.25,
person: Person {
name: String::from("drbh"),
age: 101,
},
};
let json_to_store = serde_json::to_string(&grade).unwrap();
pot.add_object_to_collection("address_book", json_to_store)?;
let query = QueryBuilder::new()
.collection("address_book")
.kind(QueryKind::Object)
.key("score")
.comparison(">=")
.float(90.25)
.finish();
Ok(())
}