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

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

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

QueryRequest.withFilterExpression介绍

[英]A string that contains conditions that DynamoDB applies after the Query operation, but before the data is returned to you. Items that do not satisfy the FilterExpression criteria are not returned.

A FilterExpression does not allow key attributes. You cannot define a filter expression based on a partition key or a sort key.

A FilterExpression is applied after the items have already been read; the process of filtering does not consume any additional read capacity units.

For more information, see Filter Expressions in the Amazon DynamoDB Developer Guide.

Returns a reference to this object so that method calls can be chained together.
[中]一个字符串,包含DynamoDB在Query操作之后,但在数据返回给您之前应用的条件。不满足FilterExpression标准的项目不会被退回。
FilterExpression不允许密钥属性。不能基于分区键或排序键定义筛选器表达式。
在项目已被读取后应用FilterExpression;过滤过程不会消耗任何额外的读取容量单位。
有关更多信息,请参阅《Amazon DynamoDB开发人员指南》中的{$0$}。
返回对此对象的引用,以便将方法调用链接在一起。

代码示例

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

/**
 * When a filter expression is specified, the corresponding name-map and
 * value-map can optionally be specified via {@link #withNameMap(Map)} and
 * {@link #withValueMap(Map)}. (Note query filters must not be specified if
 * a filter expression has been specified.)
 */
public QuerySpec withFilterExpression(String filterExpression) {
  getRequest().withFilterExpression(filterExpression);
  return this;
}

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

protected <T> QueryRequest createQueryRequestFromExpression(Class<T> clazz,
    DynamoDBQueryExpression<T> xpress, DynamoDBMapperConfig config) {
  final DynamoDBMapperTableModel<T> model = getTableModel(clazz, config);
  QueryRequest req = new QueryRequest();
  req.setConsistentRead(xpress.isConsistentRead());
  req.setTableName(getTableName(clazz, xpress.getHashKeyValues(), config));
  req.setIndexName(xpress.getIndexName());
  req.setKeyConditionExpression(xpress.getKeyConditionExpression());
  processKeyConditions(req, xpress, model);
  req.withScanIndexForward(xpress.isScanIndexForward())
    .withLimit(xpress.getLimit())
    .withExclusiveStartKey(xpress.getExclusiveStartKey())
    .withQueryFilter(xpress.getQueryFilter())
    .withConditionalOperator(xpress.getConditionalOperator())
    .withSelect(xpress.getSelect())
    .withProjectionExpression(xpress.getProjectionExpression())
    .withFilterExpression(xpress.getFilterExpression())
    .withExpressionAttributeNames(xpress.getExpressionAttributeNames())
    .withExpressionAttributeValues(xpress.getExpressionAttributeValues())
    .withReturnConsumedCapacity(xpress.getReturnConsumedCapacity())
    .withRequestMetricCollector(config.getRequestMetricCollector())
    ;
  return applyUserAgent(req);
}

代码示例来源:origin: rakam-io/rakam

String expression = formatter.process(filterExpression, false);
scanRequest.withFilterExpression(expression);
ImmutableMap<String, String> names = nameBuilder.build();
if (!names.isEmpty()) {

代码示例来源:origin: com.amazonaws/aws-java-sdk-dynamodb

/**
 * When a filter expression is specified, the corresponding name-map and
 * value-map can optionally be specified via {@link #withNameMap(Map)} and
 * {@link #withValueMap(Map)}. (Note query filters must not be specified if
 * a filter expression has been specified.)
 */
public QuerySpec withFilterExpression(String filterExpression) {
  getRequest().withFilterExpression(filterExpression);
  return this;
}

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

private static void findRepliesUsingAFilterExpression(String forumName, String threadSubject) {
     
  Map<String, Condition> keyConditions = makeReplyKeyConditions(forumName, threadSubject);
  
  Map<String, AttributeValue> expressionAttributeValues = new HashMap<String, AttributeValue>();
  expressionAttributeValues.put(":val", new AttributeValue().withS("User B")); 
  
  QueryRequest queryRequest = new QueryRequest()
    .withTableName(tableName)
    .withKeyConditions(keyConditions)
    .withFilterExpression("PostedBy = :val")
    .withExpressionAttributeValues(expressionAttributeValues)
    .withProjectionExpression("Message, ReplyDateTime, PostedBy");
   QueryResult result = client.query(queryRequest);
   for (Map<String, AttributeValue> item : result.getItems()) {
     printItem(item);
   }        
 }

代码示例来源:origin: locationtech/geowave

queryRequest.withFilterExpression(
  DynamoDBOperations.METADATA_SECONDARY_ID_KEY
    + " = :secVal").addExpressionAttributeValuesEntry(

代码示例来源:origin: locationtech/geowave

queryRequest.withFilterExpression(
  DynamoDBOperations.METADATA_SECONDARY_ID_KEY
    + " = :secVal").addExpressionAttributeValuesEntry(

代码示例来源:origin: com.amazonaws/aws-java-sdk-dynamodb

protected <T> QueryRequest createQueryRequestFromExpression(Class<T> clazz,
    DynamoDBQueryExpression<T> xpress, DynamoDBMapperConfig config) {
  final DynamoDBMapperTableModel<T> model = getTableModel(clazz, config);
  QueryRequest req = new QueryRequest();
  req.setConsistentRead(xpress.isConsistentRead());
  req.setTableName(getTableName(clazz, xpress.getHashKeyValues(), config));
  req.setIndexName(xpress.getIndexName());
  req.setKeyConditionExpression(xpress.getKeyConditionExpression());
  processKeyConditions(req, xpress, model);
  req.withScanIndexForward(xpress.isScanIndexForward())
    .withLimit(xpress.getLimit())
    .withExclusiveStartKey(xpress.getExclusiveStartKey())
    .withQueryFilter(xpress.getQueryFilter())
    .withConditionalOperator(xpress.getConditionalOperator())
    .withSelect(xpress.getSelect())
    .withProjectionExpression(xpress.getProjectionExpression())
    .withFilterExpression(xpress.getFilterExpression())
    .withExpressionAttributeNames(xpress.getExpressionAttributeNames())
    .withExpressionAttributeValues(xpress.getExpressionAttributeValues())
    .withReturnConsumedCapacity(xpress.getReturnConsumedCapacity())
    .withRequestMetricCollector(config.getRequestMetricCollector())
    ;
  return applyUserAgent(req);
}

相关文章

微信公众号

最新文章

更多

QueryRequest类方法