This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
UnmarshalListOfMaps is failed if list of custom struct is set into argument 'out' #2504
Labels
You can continue the conversation there. Go to discussion →
Describe the bug
I'm sorry if I may misunderstand the usage of UnmarshalListOfMaps, but let me make this report.
I tried to use attributevalue.UnmarshalListOfMaps to convert Items of dynamodb.ExecuteStatementOutput to list of custom struct, but It was failed with the next error.
Actually, I found the following message from api document, so I interpreted that we could utilize the function to convert the multiple items of DynamoDB's query result to []<custon struct> or []map[string]<any type>
Expected Behavior
UnmarshalListOfMaps can be used to convert []map[string]types.AttributeValue to []<custom struct>
Current Behavior
UnmarshalListOfMaps cannot be used to convert []map[string]types.AttributeValue to []<custom struct>.
Reproduction Steps
For example, the next minimum code gets failed.
Output is the following.
And also for next example with []map[string]string, we get failed.
Possible Solution
If my recognition is correct, I think it should use UnmarshalMap to each Items with instead of UnmarshalList here as behavior. But, It may be not simple code.
Additional Information/Context
No response
AWS Go SDK V2 Module Versions Used
Compiler and Version used
go version go1.22.0 linux/amd64
Operating System and version
Ubuntu 20.04.4 LTS
The text was updated successfully, but these errors were encountered: