1

Is anybody able to help me work out how to use BatchWriteItem on Arduino using the SDK at awslabs/aws-sdk-arduino

I've got putItem working fine, and from reading the library have worked out I need to change the following (currently shown with putItem as working, Batchwriteitem commented out:

In my header:

PutItemInput putItemInput;
 //BatchWriteItemInput batchWriteItemInput;

In the function:

putItemInput.setItem(MinimalMap < AttributeValue > (itemArray, 4));
putItemInput.setTableName(TABLE_NAME);
// batchWriteItemInput.setRequestItems(MinimalMap<MinimalList > requestItems);

//perform putItem and check for errors.
PutItemOutput putItemOutput = ddbClient.putItem(putItemInput, actionError);
//BatchWriteItemOutput batchWriteItemOutput = ddbClient.batchWriteItem(batchWriteItemInput, actionError);

For putItem, the library helps me create the necessary JSON for MinimalMap < AttributeValue > (itemArray, 4) using the following:

MinimalKeyValuePair < MinimalString, AttributeValue > att1(HASH_KEY_NAME, deviceValue); 
MinimalKeyValuePair < MinimalString, AttributeValue > att2(RANGE_KEY_NAME, timeValue); 
MinimalKeyValuePair < MinimalString, AttributeValue > att3(CATEGORY_KEY_NAME, categoryValue); 
MinimalKeyValuePair < MinimalString, AttributeValue > att4(DEBUG_KEY_NAME, debugValue); MinimalKeyValuePair < MinimalString, AttributeValue> itemArray[] = { att1, att2, att3, att4 };

What I can't get my head around is how to use something similar within a loop to create the MinimalMap requestItems needed for batchWriteItem.

I'm learning everything as I go with the power of google, so don't really know what I'm doing - if anyone can point me in the right direction it would be much appreciated - would be great to be able to share a working BatchWriteItem example here for others.

Paul N
  • 11
  • 1

0 Answers0