#sqlite #database-driver #flexible #ecosystem #scalable #json #serde-json

chromoe-db

An open-source, flexible, and scalable ecosystem designed for Rust-compatible database drivers

5 releases

0.1.1 Dec 2, 2024
0.1.0 Nov 28, 2024
0.0.3-alpha Nov 27, 2024
0.0.2-alpha Nov 25, 2024
0.0.1-alpha Nov 25, 2024

#1461 in Database interfaces

Download history 391/week @ 2024-11-25 134/week @ 2024-12-02 23/week @ 2024-12-09

548 downloads per month

MIT license

20KB
195 lines

ChromoeDB

Discord Server

chromoe-db is an open-source, flexible, and scalable ecosystem designed for Rust-compatible database drivers. This library facilitates easy access, storage, and updating of data. Currently, all data is persistently stored using various supported databases, with SQLite being the only one available at this time.

Installation

cargo add chromoe-db

Examples

use chromoe_db::driver::sqlite_driver::SQLiteDriver;
use serde::Serialize;
use serde_json::Value;

#[derive(Debug, Serialize)]
struct WorldData {
    time: String,
    money: i32,
}

fn main() {
    let driver = SQLiteDriver::new(None).expect("Failed to initialise SQLite driver");

    driver.set("name", "Reina").expect("Failed to set value");
    driver.set("world", WorldData { time: "Day".to_string(), money: 15000 }).expect("Failed to set value");

    let world_value: Option<Value> = driver.get("world").expect("Failed to get value");
    println!("world: {:?}", world_value);

    driver.push("cart", ["Weapon A".to_string(), "Weapon B".to_string()]).expect("Failed to push values");
    driver.add("world.money", 5000.0).expect("Failed to add value");
}

License

This library is licensed under MIT.

Dependencies

~24MB
~457K SLoC