当前位置: 首页>>代码示例>>Java>>正文


Java UpdateItemRequest.getUpdateExpression方法代码示例

本文整理汇总了Java中com.amazonaws.services.dynamodbv2.model.UpdateItemRequest.getUpdateExpression方法的典型用法代码示例。如果您正苦于以下问题:Java UpdateItemRequest.getUpdateExpression方法的具体用法?Java UpdateItemRequest.getUpdateExpression怎么用?Java UpdateItemRequest.getUpdateExpression使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.amazonaws.services.dynamodbv2.model.UpdateItemRequest的用法示例。


在下文中一共展示了UpdateItemRequest.getUpdateExpression方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: updateItem

import com.amazonaws.services.dynamodbv2.model.UpdateItemRequest; //导入方法依赖的package包/类
UpdateItemResult updateItem(final UpdateItemRequest request) throws BackendException {
    setUserAgent(request);
    UpdateItemResult result;
    final int bytes;
    if (request.getUpdateExpression() != null) {
        bytes = calculateExpressionBasedUpdateSize(request);
    } else {
        bytes = calculateItemUpdateSizeInBytes(request.getAttributeUpdates());
    }
    getBytesHistogram(UPDATE_ITEM, request.getTableName()).update(bytes);
    final int wcu = computeWcu(bytes);
    timedWriteThrottle(UPDATE_ITEM, request.getTableName(), wcu);

    final Timer.Context apiTimerContext = getTimerContext(UPDATE_ITEM, request.getTableName());
    try {
        result = client.updateItem(request);
    } catch (Exception e) {
        throw processDynamoDbApiException(e, UPDATE_ITEM, request.getTableName());
    } finally {
        apiTimerContext.stop();
    }
    meterConsumedCapacity(UPDATE_ITEM, result.getConsumedCapacity());

    return result;
}
 
开发者ID:awslabs,项目名称:dynamodb-janusgraph-storage-backend,代码行数:26,代码来源:DynamoDbDelegate.java

示例2: calculateExpressionBasedUpdateSize

import com.amazonaws.services.dynamodbv2.model.UpdateItemRequest; //导入方法依赖的package包/类
/**
 * This method calculates a lower bound of the size of a new item created with UpdateItem UpdateExpression. It does not
 * account for the size of the attribute names of the document paths in the attribute names map and it assumes that the
 * UpdateExpression only uses the SET action to assign to top-level attributes.
 * @param request UpdateItem request that uses update expressions
 * @return the size of the post-update image of the item
 */
private int calculateExpressionBasedUpdateSize(final UpdateItemRequest request) {
    if (request == null || request.getUpdateExpression() == null) {
        throw new IllegalArgumentException("request did not use update expression");
    }
    int size = calculateItemSizeInBytes(request.getKey());
    for (AttributeValue value : request.getExpressionAttributeValues().values()) {
        size += calculateAttributeSizeInBytes(value);
    }
    return size;
}
 
开发者ID:awslabs,项目名称:dynamodb-janusgraph-storage-backend,代码行数:18,代码来源:DynamoDbDelegate.java


注:本文中的com.amazonaws.services.dynamodbv2.model.UpdateItemRequest.getUpdateExpression方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。