Description
I am writing a lambda function to respond to changes in a DynamoDB table and process new items. Currently the lambda handler takes a DynamoDBEvent object defined in this repo as a parameter. Within this object, the database object is represented as a map[string]DynamoDBAttributeValue
. It seems that this DynamoDBAttributeValue
behaves quite differently to the AttributeValue
type defined in the SDK (https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/service/dynamodb/types#AttributeValue), and for example I cannot use the same attributevalue.UnmarshalMap
method to unmarshal the map to a concrete Go type.
Describe the solution you'd like
The ideal solution would be to have one and only one definition of AttributeValue
shared between both repos. Since this is likely not possible for backwards compatibility, another solution would be to add a helper method to convert between the two distinct type representations of the same logical object.
Describe alternatives you've considered
I've tried using the DynamoDBAttributeValue
type as-is, but the lack of helper methods to convert to my existing Go types is frustrating and makes the code much more susceptible to runtime panics when asserting the shape of the response object.
Thanks for any help or advice if I have missed something that already exists here.