Skip to content

Instantly share code, notes, and snippets.

@pfulop
Created January 21, 2019 21:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pfulop/3db0295a8789dc3c58c741d158f4e454 to your computer and use it in GitHub Desktop.
Save pfulop/3db0295a8789dc3c58c741d158f4e454 to your computer and use it in GitHub Desktop.
example UpdateItem with conditions
{
"version" : "2017-02-28",
"operation" : "UpdateItem",
"key" : {
"createdAt": $util.dynamodb.toDynamoDBJson($ctx.args.createdAt),
"translationState": $util.dynamodb.toDynamoDBJson('waiting')
},
"update" : {
"expression" : "SET #content = :content",
"expressionNames" : {
"#content" : "content"
},
"expressionValues" : {
":content" : $util.dynamodb.toDynamoDBJson("hello")
}
},
"condition" : {
"expression" : "#translationState = :translationState AND #translationKey = :translationKey",
"expressionNames" : {
"#translationState" : "translationState",
"#translationKey" : "translationKey"
},
"expressionValues" : {
":translationState": $util.dynamodb.toDynamoDBJson('waiting'),
":translationKey": $util.dynamodb.toDynamoDBJson($ctx.args.id)
},
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment