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


Java GetItemRequest.setTableName方法代码示例

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


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

示例1: getPoint

import com.amazonaws.services.dynamodbv2.model.GetItemRequest; //导入方法依赖的package包/类
public GetPointResult getPoint(GetPointRequest getPointRequest) {
	long geohash = S2Manager.generateGeohash(getPointRequest.getGeoPoint());
	long hashKey = S2Manager.generateHashKey(geohash, config.getHashKeyLength());

	GetItemRequest getItemRequest = getPointRequest.getGetItemRequest();
	getItemRequest.setTableName(config.getTableName());

	AttributeValue hashKeyValue = new AttributeValue().withN(String.valueOf(hashKey));
	getItemRequest.getKey().put(config.getHashKeyAttributeName(), hashKeyValue);
	getItemRequest.getKey().put(config.getRangeKeyAttributeName(), getPointRequest.getRangeKeyValue());

	GetItemResult getItemResult = config.getDynamoDBClient().getItem(getItemRequest);
	GetPointResult getPointResult = new GetPointResult(getItemResult);

	return getPointResult;
}
 
开发者ID:awslabs,项目名称:dynamodb-geo,代码行数:17,代码来源:DynamoDBManager.java

示例2: getItemResultMono

import com.amazonaws.services.dynamodbv2.model.GetItemRequest; //导入方法依赖的package包/类
private Mono<GetItemResult> getItemResultMono(String url) {

        GetItemRequest getItemRequest = new GetItemRequest();
        getItemRequest.setTableName(Utils.table.websites);
        HashMap<String, AttributeValue> key = new HashMap<>();
        key.put(Utils.params.url, new AttributeValue(url));
        getItemRequest.setKey(key);

        return Mono.fromFuture(
                Utils.makeCompletableFuture(
                        dynamoDBAsync.getItemAsync(getItemRequest)))
                .doOnError((throwable -> LOG.error(Utils.error.failed_dynamo_get, url)));
    }
 
开发者ID:hafidsousa,项目名称:webcrawler,代码行数:14,代码来源:CrawlerService.java

示例3: getItemRequest

import com.amazonaws.services.dynamodbv2.model.GetItemRequest; //导入方法依赖的package包/类
private GetItemRequest getItemRequest(String url) {

        GetItemRequest request = new GetItemRequest();
        request.setTableName(Utils.table.websites);
        HashMap<String, AttributeValue> key = new HashMap<>();
        key.put(Utils.params.url, new AttributeValue(url));
        request.setKey(key);

        return request;
    }
 
开发者ID:hafidsousa,项目名称:webcrawler,代码行数:11,代码来源:CrawlerServiceTest.java

示例4: makeItemRequestFor

import com.amazonaws.services.dynamodbv2.model.GetItemRequest; //导入方法依赖的package包/类
/**
 * Makes a GetItemRequest for a given attribute.
 * @param attr Attribute name
 * @return GetItemRequest
 */
private GetItemRequest makeItemRequestFor(final String attr) {
    final GetItemRequest request = new GetItemRequest();
    request.setTableName(this.name);
    request.setAttributesToGet(Collections.singletonList(attr));
    request.setKey(this.attributes.only(this.keys));
    request.setReturnConsumedCapacity(ReturnConsumedCapacity.TOTAL);
    request.setConsistentRead(true);
    return request;
}
 
开发者ID:jcabi,项目名称:jcabi-dynamo,代码行数:15,代码来源:AwsItem.java

示例5: findOne

import com.amazonaws.services.dynamodbv2.model.GetItemRequest; //导入方法依赖的package包/类
@Override
public <T extends Message> T findOne(T matcher, Modifier... modifiers) throws DataStoreException {
  DynamoClassMapping<T> tableInfo = getClassMapping(matcher);

  log.debug("findOne {} {}", matcher.getClass().getSimpleName(), matcher);

  Map<FieldDescriptor, Object> matcherFields = matcher.getAllFields();
  // TODO: Remove PK fields

  GetItemRequest request = new GetItemRequest();
  // TODO: Modifier for eventually consistent read?
  request.setConsistentRead(true);
  request.setTableName(tableInfo.getDynamoTableName());
  request.setKey(tableInfo.buildCompleteKey(matcher));

  for (Modifier modifier : modifiers) {
    throw new UnsupportedOperationException();
  }

  GetItemResult result = dynamoDB.getItem(request);
  Map<String, AttributeValue> itemData = result.getItem();
  if (itemData == null) {
    return null;
  }

  T item = tableInfo.mapFromDb(itemData);
  if (DataStore.matches(matcherFields, item)) {
    log.debug("found item: {}", item);
    return item;
  }

  return null;
}
 
开发者ID:justinsb,项目名称:cloudata,代码行数:34,代码来源:DynamodbDataStore.java


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