DynamoDB library for Rust.
#[derive(Raiden)]
#[raiden(table_name = "user")]
pub struct User {
#[raiden(partition_key)]
id: String,
name: String,
}
#[tokio::main]
async fn main() {
let client = User::client(Region::UsEast1);
let _res = client.get("user_primary_key").run().await;
}
#[derive(Raiden)]
#[raiden(table_name = "user")]
pub struct User {
#[raiden(partition_key)]
id: String,
name: String,
}
#[tokio::main]
async fn main() {
let client = User::client(Region::UsEast1);
let input = User::put_item_builder()
.id("foo".to_owned())
.name("bokuweb".to_owned())
.build();
let res = client.put(&input).run().await;
}
#[derive(Raiden, Debug, PartialEq)]
pub struct User {
#[raiden(partition_key)]
id: String,
#[raiden(sort_key)]
year: usize,
}
#[tokio::main]
async fn main() {
let client = User::client(Region::UsEast1);
let keys: Vec<(&str, usize)> = vec![("Alice", 1992), ("Bob", 1976), ("Charlie", 2002)];
let res = client.batch_get(keys).run().await;
}
- Rust
- Deno (1.13.2+)
- GNU Make
- Docker Engine
make dynamo
This starts up DynamoDB on Docker container, and then arranges test fixtures.
make test
NOTE: Don't recommend to use cargo test
because our test suite doesn't support running tests in parallel. Use cargo test -- --test-threads=1
instead of it.
dynamodb-admin is useful to check data in DynamoDB Local.
npx dynamodb-admin
Then open http://localhost:8001
in browser.
- BatchGetItem
- BatchWriteItem
- DeleteItem
- GetItem
- PutItem
- Query
- Scan
- TransactGetItems
- TransactWriteItems
- UpdateItem
Here is a list of unsupported features/behaviors in the actual implementation. We have a plan to resolve these issues in a future release.
- Automatic retrying: raiden-rs#44
- Strict type checking of keys: raiden-rs#26
- Exponential backoff handling