php editor Apple here introduces a method of using gosdk to declare the ValueBuilder object as a StringSet when executing UpdateItem in Dynamodb. In Dynamodb, StringSet is a data type used to store a collection of strings. By using the ValueBuilder object, we can easily construct this StringSet to update the data in Dynamodb. Next, we will introduce in detail how to use gosdk to implement this process.
NOTE: Might look like a duplicate of this but it's different because I need to do this via golang and this is in js.
I want to perform the following operations on the dynamodb project in gosdk:
updateexpression: 'add socialaccounts :socialaccountid', expressionattributevalues: { ':socialaccountid': { 'ss': [socialaccountid] } },
The typical implementation in gosdk is:
expression.add(expression.name("socialaccounts"), expression.value([]string{"socialaccountid"}))
However, the sdk does not treat the string array as a ss
(stringset) type, but as a l
(list) type.
Logged errors:
65bcdb1af85fI can't find any functionality in the documentation that specifies how types are mentioned.
Can anyone help?
Why I want to do this:
socialaccounts
does not exist. set
operation with list_append
as this may introduce duplicate elements. If you need to specify the type, please use dynamodb.attributevalue
:
Output:
{ SS: ["socialAccountId"] }
The above is the detailed content of How to declare ValueBuilder object as StringSet when executing UpdateItem in Dynamodb using gosdk?. For more information, please follow other related articles on the PHP Chinese website!