Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Swift 带起始值和结束值的AWS DynamoDB查询_Swift_Amazon Web Services_Amazon Dynamodb - Fatal编程技术网

Swift 带起始值和结束值的AWS DynamoDB查询

Swift 带起始值和结束值的AWS DynamoDB查询,swift,amazon-web-services,amazon-dynamodb,Swift,Amazon Web Services,Amazon Dynamodb,我正在尝试执行一个查询,其中我要检索高度和宽度在两个定义值之间的所有项目,如下所示: let queryExpression = AWSDynamoDBQueryExpression() queryExpression.filterExpression = ":widthSmall < #width < :width AND :heightSmall < #height < :height" queryExpression.keyConditionExpression

我正在尝试执行一个查询,其中我要检索高度和宽度在两个定义值之间的所有项目,如下所示:

let queryExpression = AWSDynamoDBQueryExpression()

queryExpression.filterExpression = ":widthSmall < #width < :width AND :heightSmall < #height < :height"
queryExpression.keyConditionExpression = "#addedByType = :addedByType"
queryExpression.expressionAttributeNames = ["#addedByType": "addedByType", "#width": "widthSmall","#height": "heightSmall","#width": "width","#height": "height"]
queryExpression.expressionAttributeValues = [":addedByType": "APPUSER", ":widthSmall": 50, ":heightSmall": 50, ":width": 100, ":height": 100]

queryExpression.scanIndexForward = false
queryExpression.limit = 200 

正确的检查方法是什么?

好的,经过一段时间的反复试验,我发现我做错了什么,并得出以下结果:

queryExpression.filterExpression = ":widthSmall < #width1 AND #width < :width AND :heightSmall < #height1 AND #height < :height"
queryExpression.keyConditionExpression = "#addedByType = :addedByType"
queryExpression.expressionAttributeNames = ["#addedByType": "addedByType", "#width1": "width","#height1": "height", "#width": "width", "#height": "height"]
queryExpression.expressionAttributeValues = [":addedByType": "APPUSER", ":widthSmall": 50, ":heightSmall": 50, ":width": 101, ":height": 101]
queryExpression.filtereexpression=“:widthssmall<#width1和#width<:width和:heightSmall<#height1和#height<:height”
queryExpression.keyConditionExpression=“#addedByType=:addedByType”
queryExpression.expressionAttributeNames=[“#addedByType”:“addedByType”、“#width1”:“width”、“#height1”:“height”、“#width”:“width”、“#height”:“height”]
queryExpression.Expression属性值=[“:addedByType”:“APPUSER”、“:widthSmall”:50、“:heightSmall:50、”:width:101、“:height:101]
问题是我在字典中引用了两次同一个键

queryExpression.filterExpression = ":widthSmall < #width1 AND #width < :width AND :heightSmall < #height1 AND #height < :height"
queryExpression.keyConditionExpression = "#addedByType = :addedByType"
queryExpression.expressionAttributeNames = ["#addedByType": "addedByType", "#width1": "width","#height1": "height", "#width": "width", "#height": "height"]
queryExpression.expressionAttributeValues = [":addedByType": "APPUSER", ":widthSmall": 50, ":heightSmall": 50, ":width": 101, ":height": 101]