Created
December 2, 2019 17:02
-
-
Save howyi/17fbee9f778682c50820e9b4019d4741 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## [Start] Inject @versioned condition.. ** | |
#set( $versionedCondition = { | |
"expression": "#version = :expectedVersion", | |
"expressionValues": { | |
":expectedVersion": $util.dynamodb.toDynamoDB($ctx.args.input.expectedVersion) | |
}, | |
"expressionNames": { | |
"#version": "version" | |
} | |
} ) | |
#set( $newVersion = $ctx.args.input.expectedVersion + 1 ) | |
$util.qr($ctx.args.input.put("version", $newVersion)) | |
$util.qr($ctx.args.input.remove("expectedVersion")) | |
## [End] Inject @versioned condition.. ** | |
## ~~~ | |
## Update condition if type is @versioned ** | |
#if( $versionedCondition ) | |
$util.qr($condition.put("expression", "($condition.expression) AND $versionedCondition.expression")) | |
$util.qr($condition.expressionNames.putAll($versionedCondition.expressionNames)) | |
$util.qr($condition.expressionValues.putAll($versionedCondition.expressionValues)) | |
#end | |
## ~~~ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment