Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/softprops/dynomite
⚡🦀 🧨 make your rust types fit DynamoDB and visa versa
https://github.com/softprops/dynomite
aws dynamodb nosql rusoto
Last synced: 4 days ago
JSON representation
⚡🦀 🧨 make your rust types fit DynamoDB and visa versa
- Host: GitHub
- URL: https://github.com/softprops/dynomite
- Owner: softprops
- License: mit
- Created: 2018-02-21T07:00:35.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2023-12-11T23:19:04.000Z (about 1 year ago)
- Last Synced: 2024-10-11T12:41:09.475Z (2 months ago)
- Topics: aws, dynamodb, nosql, rusoto
- Language: Rust
- Homepage: https://docs.rs/dynomite/
- Size: 2.4 MB
- Stars: 220
- Watchers: 5
- Forks: 53
- Open Issues: 36
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
- awesome-rust - softprops/dynomite - A library for strongly-typed and convenient interaction with `rusoto_dynamodb` [![build badge](https://github.com/softprops/dynomite/workflows/Main/badge.svg?branch=master)](https://github.com/softprops/dynomite/actions) (Libraries / Database)
- awesome-rust-cn - softprops/dynomite - 一个用于与`rusoto_dynamodb` (库 Libraries / 数据库 Database)
- awesome-rust - softprops/dynomite - A library for strongly-typed and convenient interaction with `rusoto_dynamodb` [![build badge](https://github.com/softprops/dynomite/workflows/Main/badge.svg?branch=master)](https://github.com/softprops/dynomite/actions) (Libraries / Database)
- fucking-awesome-rust - softprops/dynomite - A library for strongly-typed and convenient interaction with `rusoto_dynamodb` [![build badge](https://github.com/softprops/dynomite/workflows/Main/badge.svg?branch=master)](https://github.com/softprops/dynomite/actions) (Libraries / Database)
README
🦀🧨
dynomite
dynomite makes DynamoDB fit your types (and visa versa)
## Overview
Goals
* ⚡ make writing [dynamodb](https://aws.amazon.com/dynamodb/) applications in [rust](https://www.rust-lang.org/) a productive experience
* 🦀 exploit rust's type safety features
* 👩💻 leverage existing work of the [rusoto](https://github.com/rusoto/rusoto) rust project
* ☔ commitment to supporting applications built using stable rust
* 📚 commitment to documentationFeatures
* 💌 less boilerplate
* ♻️ automatic async pagination
* 🕶️ client level retry interfaces for [robust error handling](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Programming.Errors.html)From this
```rust
use std::collections::HashMap;
use rusoto_dynamodb::AttributeValue;
use uuid::Uuid;let mut item = HashMap::new();
item.insert(
"pk".to_string(), AttributeValue {
s: Some(Uuid::new_v4().to_hyphenated().to_string()),
..AttributeValue::default()
}
);
item.insert(
// 🤬typos anyone?
"quanity".to_string(), AttributeValue {
n: Some("whoops".to_string()),
..AttributeValue::default()
}
);
```To this
```rust
use dynomite::Item;
use uuid::Uuid;#[derive(Item)]
struct Order {
#[dynomite(partition_key)]
pk: Uuid,
quantity: u16
}let item = Order {
pk: Uuid::new_v4(),
quantity: 4
}.into();
```Please see the [API documentation](https://softprops.github.io/dynomite) for how
to get started. Enjoy.## 📦 Install
In your Cargo.toml file, add the following under the `[dependencies]` heading
```toml
dynomite = "0.10"
```## 🤸 Examples
You can find some example application code under [dynomite/examples](dynomite/examples)
### DynamoDB local
AWS provides [a convenient way to host a local instance of DynamoDB](https://hub.docker.com/r/amazon/dynamodb-local/) for
testing.Here is a short example of how to get up a testing locally quickly with both dynomite as well as `rusoto_dynamodb`.
In one terminal spin up a Docker container for [DynamoDB local](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocal.UsageNotes.html) listening on port `8000`
```sh
$ docker run --rm -p 8000:8000 amazon/dynamodb-local
```In another, run a rust binary with a client initialized like you see the the [local.rs example](dynomite/examples/local.rs)
## Resources
* [How DynamoDB works](https://www.slideshare.net/AmazonWebServices/amazon-dynamodb-under-the-hood-how-we-built-a-hyperscale-database-dat321-aws-reinvent-2018)
Doug Tangren (softprops) 2018-2020