[][src]Macro dynomite::attr_map

macro_rules! attr_map {
    (@single $($x:tt)*) => { ... };
    (@count $($rest:expr),*) => { ... };
    ($($key:expr => $value:expr,)+) => { ... };
    ($($key:expr => $value:expr),*) => { ... };
}

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

This provides some convenience for some interfaces, like query where a map of this type is required.

This syntax for this macro is the same as maplit.

A avoid using &str slices for values when creating a mapping for a String AttributeValue. Instead use a String.

Example

use dynomite::dynamodb::QueryInput;
use dynomite::attr_map;

let query = QueryInput {
  table_name: "some_table".into(),
  key_condition_expression: Some(
    "partitionKeyName = :partitionkeyval".into()
  ),
  expression_attribute_values: Some(
    attr_map! {
       ":partitionkeyval" => "rust".to_string()
     }
   ),
   ..QueryInput::default()
};