Crate dynomite

Source
Expand description

Dynomite is the set of high-level interfaces making interacting with AWS DynamoDB more productive.

đź’ˇTo learn more about DynamoDB, see this helpful guide.

§Data Modeling

Dynomite adapts Rust’s native types to DynamoDB’s core components to form a coherent interface.

The Attribute type provides conversion interfaces to and from Rust’s native scalar types which represent DynamoDB’s notion of “attributes”. The goal of this type is to make representing AWS typed values feel more natural and ergonomic in Rust. Where a conversion is not available you can implement Attribute for your own types to leverage higher level functionality.

The Item type provides conversion interfaces for complex types which represent DynamoDB’s notion of “items”.

💡 A cargo feature named “derive” makes it easy to derive Item instances for your custom types. This feature is enabled by default.

 use dynomite::Item;
 use uuid::Uuid;

#[derive(Item)]
struct Order {
  #[dynomite(partition_key)]
  user: Uuid,
  #[dynomite(sort_key)]
  order_id: Uuid,
  color: Option<String>
}

§Rusoto extensions

By importing the dynomite::DynamoDbExt trait, dynomite adds client interfaces for creating async Stream-based auto pagination interfaces.

§Robust retries

By importing the dynomite::Retries trait, dynomite provides an interface for adding configuration retry policies so your rusoto DynamoDb clients.

§Errors

Some operations which require coercion from AWS to Rust types may fail which results in an AttributeError.

§Cargo Features

This crate has a few cargo features of note.

§uuid

Enabled by default, the uuid feature adds support for implementing Attribute for the uuid crate’s type Uuid, a useful type for producing and representing unique identifiers for items that satisfy effective characteristics for partition keys

§chrono

Enabled by default, the chrono feature adds an implementation of Attribute for the std’s SystemTime and chrono DateTime types which internally use rfc3339 timestamps.

§derive

Enabled by default, the derive feature enables the use of the dynomite derive feature which allows you to simply add #[derive(Item)] to your structs.

§rustls

Disabled by default, the rustls feature overrides Rusoto’s default tls dependency on OpenSSL, replacing it with a rustls based tls implementation. When you enable this feature. It will also enable uuid and derive by default.

To disable any of these features

[dependencies.dynomite]
version = "xxx"
default-features = false
features = ["feature-you-want"]

Re-exports§

pub use crate::retry::Retries;
pub use crate::error::AttributeError;
pub use rusoto_dynamodb_default as dynamodb;

Modules§

error
Dynomite error types
retry
Retry functionality

Macros§

attr_map
Creates a HashMap<String, AttributeValue> from a list of key-value pairs

Traits§

Attribute
A type capable of being converted into an or from and AWS AttributeValue
DynamoDbExt
Extension methods for DynamoDb client types
FromAttributes
A type capable of being produced from a set of string keys and AttributeValues
Item
A type which can be converted to and from a set of String keys and AttributeValues.

Type Aliases§

Attributes
Type alias for map of named attribute values