hotpot-db 0.0.0

🌶 hottest way to store data on the web. If you like JSON and dealing with things later
Documentation

hotpot-db

The 🌶🌶🌶 hottest way to store data

hotpot-db is a spicy, incredibly easy to use, and delcious database system.

# COMING SOON!
# hotpot_db = "0.0.0"

What in the pot?

  1. schemaless
  2. reliable (uses SQLite3)
  3. embeddable
  4. fast
  5. JSON store
  6. 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();

    // lets make a new collection
    pot.create_collection("address_book")?;

    // we can add complex structs that are nested
    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)?;

    // well add a second one
    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)?;

    // this queries for scores that are above a specific value
    let query = QueryBuilder::new()
        .collection("address_book")
        .kind(QueryKind::Object)
        .key("score")
        .comparison(">=")
        .float(90.25)
        .finish();

    Ok(())
}