2
    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 = 属性,但我还没有找到任何关于如何构建它的好方向。我在AWSiOSSDKv2iOS 上使用 aws sdkxcode6

这是我到目前为止所拥有的。它还没有完成:

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

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

1 回答 1

1

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

AWSDynamoDBCondition *condition = [AWSDynamoDBCondition new];
AWSDynamoDBAttributeValue *attribute = [AWSDynamoDBAttributeValue new];
attribute.N = @"400";
condition.attributeValueList = @[attribute];
condition.comparisonOperator = AWSDynamoDBComparisonOperatorEQ;
scanExpression.scanFilter = @{@"lat": condition};
于 2014-09-11T20:32:03.943 回答