[英]List key values in AWS DynamoDB
What would be an example on how to perform a query in AWS DynamoDB using the C++ SDK? 如何使用C ++ SDK在AWS DynamoDB中执行查询的示例将是什么? I cannot find such an example in TableOperationTest.cpp in "aws-cpp-sdk-dynamodb-integration-tests".
我在“ aws-cpp-sdk-dynamodb-integration-tests”的TableOperationTest.cpp中找不到这样的示例。
When I use "getItemRequest" to use a hash key to get an item result from DynamoDB, how to can I get the "key value" for the non-hash key? 当我使用“ getItemRequest”使用哈希键从DynamoDB获取项目结果时,如何获得非哈希键的“键值”?
For example, I have created a dynamo table as follows. 例如,我创建了一个发电机表,如下所示。 "id" is the hash key.
“ id”是哈希键。
{ "id": "1", "Status": "0", }
getItemRequest.AddKey("id", "1");
getItemRequest.SetTableName("mytablename");
auto getItemOutcome = dynamoDbClient.GetItem(getItemRequest);
GetItemResult result = getItemOutcome.GetResult();
Aws::Map<Aws::String, AttributeValue> returnedItemCollection = result.GetItem();
std::cout << "Status: " << returnedItemCollection["Status"].GetS() << std::endl;
I need to specify the key "Status"
to get attribute value using returnedItemCollection["Status"].GetS()
. 我需要指定键
"Status"
以使用returnedItemCollection["Status"].GetS()
来获取属性值。 How can I know the item has a key "Status"
? 我怎么知道该物品有一个钥匙
"Status"
?
Do you mean, how can you know what keys are in the result? 您的意思是,您如何知道结果中包含哪些键? Perhaps I misunderstand the question, but isn't as simple as this?
也许我误解了这个问题,但这不是那么简单吗?
for(auto& itemEntry : returnedItemCollection)
{
std::cout << itemEntry.first << ": " << itemEntry.second.GetS() << std::endl;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.