software.amazon.awssdk.services.dynamodb.model.ComparisonOperator Java Examples

The following examples show how to use software.amazon.awssdk.services.dynamodb.model.ComparisonOperator. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MetaStore.java    From aws-dynamodb-encryption-java with Apache License 2.0 5 votes vote down vote up
@Override
public long getMaxVersion(final String materialName) {

    final List<Map<String, AttributeValue>> items =
        ddb.query(
            QueryRequest.builder()
                        .tableName(tableName)
                        .consistentRead(Boolean.TRUE)
                        .keyConditions(
                            Collections.singletonMap(
                                DEFAULT_HASH_KEY,
                                Condition.builder()
                                         .comparisonOperator(ComparisonOperator.EQ)
                                         .attributeValueList(AttributeValue.builder().s(materialName).build())
                                         .build()))
                        .limit(1)
                        .scanIndexForward(false)
                        .attributesToGet(DEFAULT_RANGE_KEY)
                        .build())
           .items();

    if (items.isEmpty()) {
        return -1L;
    } else {
        return Long.parseLong(items.get(0).get(DEFAULT_RANGE_KEY).n());
    }
}
 
Example #2
Source File: DynamoDBPositionsStorage.java    From liiklus with MIT License 4 votes vote down vote up
static Condition condition(ComparisonOperator eq, AttributeValue attribute) {
    return Condition.builder().comparisonOperator(eq).attributeValueList(attribute).build();
}