dicedb-rs
Unofficial Rust SDK for DiceDB.
This project is a work in progress, and are missing GET.WATCH and UNWATCH features, quality of life features.
Usage
Add as a dependency in your Rust project.
cargo add dicedb-rs
Example usage
Some initial simple examples of how to use the sdk.
fn main() -> Result<(), client::ClientError> {
let mut client = Client::new("localhost".to_string(), 7379).unwrap();
client.set("Hello", "World")?;
let value = client.get("Hello")?;
println!("Hello: {}", value);
client.set("my_int", 1)?;
client.incrby("my_int", 5)?;
client.decr("my_int")?;
let int_value = client.get("my_int")?;
match int_value {
Value::VInt(int_value) => println!("my_int: {}", int_value),
_ => println!("my_int is not an int? oh nouh!, someone changed my int!"),
}
client.del(vec!["my_int", "Hello"])?;
Ok(())
}
Build
Pre-requisites:
- Install the protobuf compiler (protoc) - ex. Protobuf for arch.
- Rustup
cargo build
Test
cargo test