OStack程序员社区-中国程序员成长平台

标题: ios - 在objective-c中带有扫描过滤器的dynamodb scanexpression [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-13 01:44
标题: ios - 在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 个,如上面的一段代码所示。

现在的问题是我想添加一个 scanExpression.scanFilter = 属性,但我还没有找到关于如何构建它的任何好的方向。我在 xcode6

上使用适用于 iOS 的 AWSiOSSDKv2 aws sdk

这是我目前所拥有的。还没有完成:

    AWSDynamoDBCondition *condition = [AWSDynamoDBCondition new];
    AWSDynamoDBAttributeValue *attribute = [AWSDynamoDBAttributeValue new];
    attribute.N = @"400";
    condition.comparisonOperator = AWSDynamoDBComparisonOperatorEQ;

    NSDictionary *scanFilter = @{@"lat":
                                     @{@"AttributeValueList":attribute,
                                       @"ComparisonOperator"1}
                                 };
    scanExpression.scanFilter = scanFilter;



Best Answer-推荐答案


您可以按如下方式使用它:

AWSDynamoDBCondition *condition = [AWSDynamoDBCondition new];
AWSDynamoDBAttributeValue *attribute = [AWSDynamoDBAttributeValue new];
attribute.N = @"400";
condition.attributeValueList = @[attribute];
condition.comparisonOperator = AWSDynamoDBComparisonOperatorEQ;
scanExpression.scanFilter = @{@"lat": condition};

关于ios - 在objective-c中带有扫描过滤器的dynamodb scanexpression,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25792359/






欢迎光临 OStack程序员社区-中国程序员成长平台 (https://ostack.cn/) Powered by Discuz! X3.4