本文介紹了在objective-c中帶有掃描過濾器的dynamodb scanexpression的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
AWSDynamoDBObjectMapper *dynamoDBObjectMapper = [AWSDynamoDBObjectMapper defaultDynamoDBObjectMapper];
AWSDynamoDBScanExpression *scanExpression = [AWSDynamoDBScanExpression new];
scanExpression.exclusiveStartKey = nil;
scanExpression.limit = @20;
[[[dynamoDBObjectMapper scan:[DDBTableRow class]
expression:scanExpression]
continueWithExecutor:[BFExecutor mainThreadExecutor] withSuccessBlock:^id(BFTask *task) { ................
我能夠掃描并返回從我的 DynamoDB 的特定表中記錄的前 20 個,如上面的一段代碼所示.
I am able to scan through and return the first 20 recorded from a specific table from my DynamoDB as shows on a piece of code above.
現在的問題是我想添加一個 scanExpression.scanFilter =
屬性,但我還沒有找到關于如何構建它的任何好的方向.我在 xcode6
The question now is I want to add a scanExpression.scanFilter =
property but I haven't find any good direction on how to build that. I am using AWSiOSSDKv2
aws sdk for iOS on xcode6
這是我目前所擁有的.還沒有完成:
here is what I have so far. It is not complete yet:
AWSDynamoDBCondition *condition = [AWSDynamoDBCondition new];
AWSDynamoDBAttributeValue *attribute = [AWSDynamoDBAttributeValue new];
attribute.N = @"400";
condition.comparisonOperator = AWSDynamoDBComparisonOperatorEQ;
NSDictionary *scanFilter = @{@"lat":
@{@"AttributeValueList":attribute,
@"ComparisonOperator":@1}
};
scanExpression.scanFilter = scanFilter;
推薦答案
可以如下使用:
AWSDynamoDBCondition *condition = [AWSDynamoDBCondition new];
AWSDynamoDBAttributeValue *attribute = [AWSDynamoDBAttributeValue new];
attribute.N = @"400";
condition.attributeValueList = @[attribute];
condition.comparisonOperator = AWSDynamoDBComparisonOperatorEQ;
scanExpression.scanFilter = @{@"lat": condition};
這篇關于在objective-c中帶有掃描過濾器的dynamodb scanexpression的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!