aws-appsync

Querying DynamoDB with a list in AWS AppSync

蓝咒 提交于 2020-08-23 05:01:34
问题 I am trying to build an AWS AppSync query with a list using IN : { "version" : "2017-02-28", "operation" : "Query", "index" : "my-index", "query" : { "expression": "id IN :ids", "expressionValues" : { ":ids" : $util.dynamodb.toStringSet($ctx.args.ids) } }, "limit": $util.defaultIfNull(${ctx.args.first}, 20), "nextToken": $util.toJson($util.defaultIfNullOrBlank($ctx.args.after, null)) } However, trying it out with parameters like: query ListItemsWithIdList { listItemsWithIdList(first:20, ids:

Querying DynamoDB with a list in AWS AppSync

拜拜、爱过 提交于 2020-08-23 05:01:20
问题 I am trying to build an AWS AppSync query with a list using IN : { "version" : "2017-02-28", "operation" : "Query", "index" : "my-index", "query" : { "expression": "id IN :ids", "expressionValues" : { ":ids" : $util.dynamodb.toStringSet($ctx.args.ids) } }, "limit": $util.defaultIfNull(${ctx.args.first}, 20), "nextToken": $util.toJson($util.defaultIfNullOrBlank($ctx.args.after, null)) } However, trying it out with parameters like: query ListItemsWithIdList { listItemsWithIdList(first:20, ids:

velocity template loop through array to create string

╄→гoц情女王★ 提交于 2020-08-10 19:30:05
问题 I'm trying to use the velocity templating language in an AWS appsync resolver to create a string by looping through an array of characters. Given the array listOfWords = ["好" "克力"] how would I achieve the string output of queryString = "+\"好\" +\"克力\"" So far I have managed something like this: 24: #set($listOfWords = ["好" "克力"]) 25: #set($queryString = "") 26: #foreach($word in $listOfWords) 27: #if( $velocityCount == 1 ) 28: #set($queryString = "+\"$word\"") 29: #else 30: #set($queryString

Stringify JSON object for SQL query in AWS AppSync

狂风中的少年 提交于 2020-07-31 03:53:45
问题 Question : How can I stringify JSON object for SQL statement in my Appsync velocity template? Explanation : I have an Aurora RDS table that has a column with data type JSON. AppSync API is already connected to RDS. My GraphQL schema looks like input CreateServiceCatalogItemInput { serviceName: String! serviceConfig: ServiceConfigInput! } type Mutation { createServiceCatalogItem(input: CreateServiceCatalogItemInput!): ServiceCatalogItem } type Query { getAllServiceCatalogItem: