attributevalue.MarshalMap() to AttributeValueMemberNULL field with double pointer #2726
Open
2 tasks done
Labels
bug
This issue is a bug.
feature/dynamodb/attributevalue
Pertains to dynamodb attributevalue marshaler HLL (feature/dynamodb/attributevalue).
p3
This is a minor priority issue
queued
This issues is on the AWS team's backlog
Acknowledgements
go get -u github.com/aws/aws-sdk-go-v2/...
)Describe the bug
When working with dynamodb using attributevalue.MarshalMap() on a struct with
omitempty
on a field, I want to be able to return atypes.AttributeValueMemberNULL
in order to null out a field in dynamodb.To achieve this, I want to use a double pointer on the field such that I can assign a nil pointer to my primative type and reference it with the double pointer. When encoding to JSON, for instance, this will encode the value
null
for that field in the output. TheMarshalMap()
appears to mistakenly think that the value double pointed to is nil, that it should not output anything whenomitempty
is set on the struct.Expected Behavior
I would expect
types.AttributeValueMemberNULL
to be returned for the key in the result av map.Current Behavior
The key for the struct field is omited from the map.
Reproduction Steps
Possible Solution
Check if a value of a pointer is a non-nil pointer to another pointer that is nil, in that case, return a
types.AttributeValueMemberNULL
instead of omitting the field from the output.Additional Information/Context
No response
AWS Go SDK V2 Module Versions Used
github.com/aws/aws-sdk-go-v2 v1.30.3
github.com/aws/aws-sdk-go-v2/feature/dynamodb/attributevalue v1.14.10
github.com/aws/aws-sdk-go-v2/feature/dynamodb/expression v1.7.32
github.com/aws/aws-sdk-go-v2/service/dynamodb v1.34.4
Compiler and Version used
go version go1.22.2 linux/amd64
Operating System and version
Fedora 39
The text was updated successfully, but these errors were encountered: