Dynarust
An opinionated DynamoDB ODM library for Rust that maps structs
to native Dynamo items using serde
and serde_json.
It only works with tables with a HASH key and a RANGE key, referred in
the code as pk and sk. This setup can be useful for a very wide variety
of use cases.
use ;
use json;
async
Setup
In order to use this library, the table setup would need to look like this equivalent CFN template:
DynamoDBTable:
Type: AWS::DynamoDB::Table
Properties:
TableName: my-table
AttributeDefinitions:
- AttributeName: PrimaryKey
AttributeType: S
- AttributeName: SecondaryKey
AttributeType: S
KeySchema:
- AttributeName: PrimaryKey
KeyType: HASH
- AttributeName: SecondaryKey
KeyType: RANGE
dynarust expects that attributes PrimaryKey and SecondaryKey are declared in the key schema
as HASH and RANGE values, and that both are of type S (string).
Coming next
- Support for global secondary indexes, with the same API that exists right now for the primary ones.
Current Limitations
- Only works with the
HASHandRANGEkeys setup. - It is not compatible with global or local secondary indexes.
- Missing some batch operations, right now only
batch_getis implemented.