DynamoDB is an AWS database that stores key/value and document data.
serde_dynamo provides a way to serialize and deserialize between data stored in these items and strongly-typed Rust data structures.
You may be looking for
Features
Support for aws-sdk-dynamodb, aws_lambda_events, and rusoto_dynamodb is provided via features. See the docs for more details.
Examples
See the docs for more examples.
Parsing items as strongly-typed data structures.
Items received from a aws-sdk-dynamodb call can be run through from_items
.
;
// Get documents from DynamoDB
let result = client.scan.table_name.send.await?;
// And deserialize them as strongly-typed data structures
if let Some = result.items
Alternatively, to deserialize one item at a time, from_item
can be used.
for item in result.items.unwrap
Creating items by serializing data structures
Writing an entire data structure to DynamoDB typically involves using to_item
to serialize
it.
;
// Create a user
let user = User ;
// Turn it into an item that aws-sdk-dynamodb understands
let item = to_item?;
// And write it!
client.put_item.table_name.set_item.send.await?;