Skip to content

Instantly share code, notes, and snippets.

@claym
Last active March 13, 2020 00:34
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 claym/4d58914486d8bbfa6c5e523b6ff18e42 to your computer and use it in GitHub Desktop.
Save claym/4d58914486d8bbfa6c5e523b6ff18e42 to your computer and use it in GitHub Desktop.
query:
query getEvent {
listEventInstances (filter: {date: {eq: "2020-03-11"}}){
items{
id
date
}
}
}
resolver:
#set( $limit = $util.defaultIfNull($context.args.limit, 10) )
#set( $ListRequest = {
"version": "2017-02-28",
"limit": $limit
} )
#if( $context.args.nextToken )
#set( $ListRequest.nextToken = $context.args.nextToken )
#end
#if( $context.args.filter )
#set( $ListRequest.filter = $util.parseJson("$util.transform.toDynamoDBFilterExpression($ctx.args.filter)") )
#end
#if( !$util.isNull($modelQueryExpression)
&& !$util.isNullOrEmpty($modelQueryExpression.expression) )
$util.qr($ListRequest.put("operation", "Query"))
$util.qr($ListRequest.put("query", $modelQueryExpression))
#if( !$util.isNull($ctx.args.sortDirection) && $ctx.args.sortDirection == "DESC" )
#set( $ListRequest.scanIndexForward = false )
#else
#set( $ListRequest.scanIndexForward = true )
#end
#else
$util.qr($ListRequest.put("operation", "Scan"))
#end
$util.toJson($ListRequest)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment