Skip to content

Rust based Sled Key-Value store db as Key-Structured Value Wrapper

License

Notifications You must be signed in to change notification settings

Walker-00/sled_json

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rust

sled_json

Rust based Sled Key-Value store db as Key-Structured Value Wrapper

Usage

Cargo.toml

[dependencies]
serde = { version = "1.0.188", features = ["derive"] }
sled_json = { git = "https://github.com/Walker-00/sled_json" }

main.rs

use serde::{Serialize, Deserialize};
use sled_json::JsonDb;

#[derive(Serialize, Deserialize, Debug)]
struct Info {
    name: String,
    age: u8,
}

fn main() {
    let linus_walker = Info {
        name: "Linus Walker".into(),
        age: 14,
    };
    let db = JsonDb::open("db").unwrap();
    db.insert("linus_walker", &linus_walker).unwrap();
    let resul = db.get::<Info>(&"linus_walker".to_string()).unwrap();
    println!("{resul:?}");
}

Credit

Just a Json Based Wrapper for SledDb with the help of Serde

About

Rust based Sled Key-Value store db as Key-Structured Value Wrapper

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages