com.amazonaws.services.dynamodbv2.model.QueryRequest.withIndexName()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(3.7k)|赞(0)|评价(0)|浏览(147)

本文整理了Java中com.amazonaws.services.dynamodbv2.model.QueryRequest.withIndexName方法的一些代码示例,展示了QueryRequest.withIndexName的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。QueryRequest.withIndexName方法的具体详情如下:
包路径:com.amazonaws.services.dynamodbv2.model.QueryRequest
类名称:QueryRequest
方法名:withIndexName

QueryRequest.withIndexName介绍

[英]The name of an index to query. This index can be any local secondary index or global secondary index on the table. Note that if you use the IndexName parameter, you must also provide TableName.

Returns a reference to this object so that method calls can be chained together.

Constraints:
Length: 3 - 255
Pattern: [a-zA-Z0-9_.-]+
[中]要查询的索引的名称。该索引可以是表上的任何本地二级索引或全局二级索引。请注意,如果使用IndexName参数,还必须提供TableName.
返回对此对象的引用,以便将方法调用链接在一起。
限制条件:
长度:3-255
图案:[a-zA-Z0-9.-]+

代码示例

代码示例来源:origin: aws-amplify/aws-sdk-android

.withTableName(tableName)
.withConsistentRead(isConsistentRead)
.withIndexName(this.indexName);

代码示例来源:origin: aws-amplify/aws-sdk-android

.withSelect(Select.COUNT)
.withConsistentRead(isConsistentRead)
.withIndexName(this.indexName);

代码示例来源:origin: stackoverflow.com

Condition hashKeyCondition = new Condition();
hashKeyCondition.withComparisonOperator(ComparisonOperator.EQ).withAttributeValueList(new AttributeValue().withS(hashKeyAttributeValue));

Condition rangeKeyCondition = new Condition();
rangeKeyCondition.withComparisonOperator(ComparisonOperator.GT).withAttributeValueList(new AttributeValue().withN(timestamp.toString()));

Map<String, Condition> keyConditions = new HashMap<String, Condition>();
keyConditions.put(MappedItem.INDEXED_ATTRIBUTE_NAME, hashKeyCondition);
keyConditions.put(MappedItem.TIMESTAMP, rangeKeyCondition);

QueryRequest queryRequest = new QueryRequest();
queryRequest.withTableName(tableName);
queryRequest.withIndexName(MappedItem.INDEX_NAME);
queryRequest.withKeyConditions(keyConditions);

QueryResult result = amazonDynamoDBClient.query(queryRequest);

List<MappedItem> mappedItems = new ArrayList<MappedItem>();

for(Map<String, AttributeValue> item : result.getItems()) {
  MappedItem mappedItem = dynamoDBMapper.marshallIntoObject(MappedItem.class, item);
  mappedItems.add(mappedItem);
}

return mappedItems;

代码示例来源:origin: awslabs/amazon-kinesis-aggregators

.put(DynamoDataStore.SCATTER_PREFIX_ATTRIBUTE, c);
QueryRequest req = new QueryRequest()
    .withIndexName(this.indexName)
    .withTableName(this.tableName)
    .withKeyConditions(this.conditions);

代码示例来源:origin: aws-samples/aws-dynamodb-examples

.withIndexName(indexName)
.withScanIndexForward(true);

代码示例来源:origin: com.jcabi/jcabi-dynamo

request = request.withIndexName(this.index);

代码示例来源:origin: jcabi/jcabi-dynamo

request = request.withIndexName(this.index);

代码示例来源:origin: amazon-archives/dynamodb-geo

.withIndexName(config.getGeohashIndexName()).withConsistentRead(true)
.withReturnConsumedCapacity(ReturnConsumedCapacity.TOTAL).withExclusiveStartKey(lastEvaluatedKey);

代码示例来源:origin: jcabi/jcabi-dynamo

.withLimit(Integer.MAX_VALUE);
if (!this.index.isEmpty()) {
  request = request.withIndexName(this.index);

代码示例来源:origin: com.jcabi/jcabi-dynamo

.withLimit(Integer.MAX_VALUE);
if (!this.index.isEmpty()) {
  request = request.withIndexName(this.index);

代码示例来源:origin: amazon-archives/dynamodb-geo

public static QueryRequest copyQueryRequest(QueryRequest queryRequest) {
    QueryRequest copiedQueryRequest = new QueryRequest().withAttributesToGet(queryRequest.getAttributesToGet())
        .withConsistentRead(queryRequest.getConsistentRead())
        .withExclusiveStartKey(queryRequest.getExclusiveStartKey()).withIndexName(queryRequest.getIndexName())
        .withKeyConditions(queryRequest.getKeyConditions()).withLimit(queryRequest.getLimit())
        .withReturnConsumedCapacity(queryRequest.getReturnConsumedCapacity())
        .withScanIndexForward(queryRequest.getScanIndexForward()).withSelect(queryRequest.getSelect())
        .withTableName(queryRequest.getTableName());

    return copiedQueryRequest;
  }
}

相关文章

微信公众号

最新文章

更多

QueryRequest类方法