Expression
An Expression case class represents various expressions in DynamoDB actions including:
- FilterExpression - Scan API
- UpdateExpression - UpdateItem API
- ConditionExpression - UpdateItem API
- ConditionExpression - PutItem API
- ProjectionExpression - GetItem, Query, or Scan API
These expressions in DynamoDB share the same structure, hence, in meteor they are abstracted as:
case class Expression(
expression: String,
attributeNames: Map[String, String],
attributeValues: Map[String, AttributeValue]
)
For example:
Expression(
expression = "#pAt BETWEEN :from AND :to",
attributeNames = Map(
"#pAt" -> "publishedAt"
),
attributeValues = Map(
":from" -> 1870.asAttributeValue,
":to" -> 1880.asAttributeValue
)
)
where expression: String is DynamoDB expression syntax which mirrors Java AWS SDK. # and :
prefixes of pAt, from and to are part of the syntax, to avoid crashes with internal DynamoDB
reserved words. The actual attribute’s name and value are replaced by providing the attributeNames
and attributeValues map respectively.