Skip to content

Instantly share code, notes, and snippets.

@adrianhall
Last active December 19, 2018 18:04
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 adrianhall/69045b2c1fcb7720a00b7298bc6dcf46 to your computer and use it in GitHub Desktop.
Save adrianhall/69045b2c1fcb7720a00b7298bc6dcf46 to your computer and use it in GitHub Desktop.
#if($ctx.prev.result.ids.size() == 0)
#set($result = {})
$util.qr($result.put("totalCount", $ctx.prev.result.totalCount))
$util.qr($result.put("nextToken",$ctx.prev.result.nextToken))
$util.qr($result.put("items", $ctx.prev.result.ids))
#return($result)
#end
#set($keys = [])
#foreach($id in ${ctx.prev.result.ids})
#set($key = {})
$util.qr($key.put("typeName", $util.dynamodb.toString("LOCATION")))
$util.qr($key.put("id", $util.dynamodb.toString($id)))
$util.qr($keys.add($key))
#end
{
"version": "2018-05-29",
"operation" : "BatchGetItem",
"tables" : {
"devRestaurantReviews": {
"keys": $util.toJson($keys),
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment