Please fill out the sections below to help us address your issue.
go version)?go version go1.9.2
I have created a attribute of type String Set in Dynamodb. When I create create the Item and assign an attribute of type SS everything works. But when I try to update this attribute using dynamodbattribute.Marshal(), the data type changes to a list ("L").
If you have have an runnable example, please include it.
@Aprimit thanks for reaching out to us. Correct the marshaler assumes a string slice is a list because a string set implies that there are no duplicate values within the list. Since only the application providing the slice to the marshaler knows if the data is actually a set or arbitrary list the application needs to signal the marshaler to process the value as a string set.
It looks like the marshaler doesn't document this condition very well. We should update the documentation to make this more clear.
@jasdel thanks for the quick response. Well, could you please provide an example of how to signal the marshaler to process the slice as stringset ?
Sure the dynamodbav:",stringset" struct tag is the best way to tell the marshaler that the field should be treated as a string set instead of a list.
e.g
type MyType struct {
// Field will be marshaled as a string set
Field []string `dynamodbav:",stringset"`
}
@jasdel the suggested solution works for me. Appreciate your help here. Thank you 馃憤