Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save atlascoder/00a0683f5fbdf46f6447e13ed547f8be to your computer and use it in GitHub Desktop.
Save atlascoder/00a0683f5fbdf46f6447e13ed547f8be to your computer and use it in GitHub Desktop.

Revisions

  1. @koingdev koingdev created this gist Jul 22, 2019.
    22 changes: 22 additions & 0 deletions query-local-secondary-index.vtl
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,22 @@
    ## REQUEST MAPPING
    {
    "version" : "2017-02-28",
    "operation" : "Query",
    "index": "shopID-vendorID-index",
    "query" : {
    "expression": "shopID = :shopID AND vendorID = :vendorID",
    "expressionValues" : {
    ":shopID" : $util.dynamodb.toDynamoDBJson($ctx.args.shopID),
    ":vendorID" : $util.dynamodb.toDynamoDBJson($ctx.args.vendorID)
    }
    }
    }


    ## RESPONSE MAPPING
    ## Query operation always returns a set of results not just one
    #if ($ctx.result.items.size() > 0)
    $util.toJson($ctx.result.items[0])
    #else
    null
    #end