You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
In Go, sets of type T are commonly stored as map[T]struct{} or map[T]bool (also common but wastes memory). Unlike []T (slice of T), maps make it much easier to check if a given item is present. However, the DynamoDB SDK only allows marshaling these values as maps.
Describe the solution you'd like
Struct members of type map[string|number]struct{} (and optionally map[string|number]bool) should be able to be encoded/decoded as DynamoDB StringSet|NumberSet. For clarity, if map[string|number]bool was supported, false items would not be encoded. All decoded items would be true.
Note: BinarySet should be considered as a possible 3rd type of set to encode/decode using a map
Describe alternatives you've considered
I have not considered any other ways to marshal into a DynamoDB set.
jasdel
changed the title
[dynamodb] Encode map[string]struct{} as StringSet, not just []string
dynamodb/attributevalue: Encode map[string]struct{} as StringSet, not just []string
Nov 12, 2020
We have noticed this issue has not received attention in 1 year. We will close this issue for now. If you think this is in error, please feel free to comment and reopen the issue.
Is your feature request related to a problem? Please describe.
In Go, sets of type
T
are commonly stored asmap[T]struct{}
ormap[T]bool
(also common but wastes memory). Unlike[]T
(slice ofT
), maps make it much easier to check if a given item is present. However, the DynamoDB SDK only allows marshaling these values as maps.Describe the solution you'd like
Struct members of type
map[string|number]struct{}
(and optionallymap[string|number]bool
) should be able to be encoded/decoded as DynamoDBStringSet
|NumberSet
. For clarity, ifmap[string|number]bool
was supported,false
items would not be encoded. All decoded items would betrue
.Note: BinarySet should be considered as a possible 3rd type of set to encode/decode using a map
Describe alternatives you've considered
I have not considered any other ways to marshal into a DynamoDB set.
https://www.davidkaya.com/sets-in-golang/
Originally filed under V1: aws/aws-sdk-go#3408
https://github.com/guregu/dynamo supports this.
The text was updated successfully, but these errors were encountered: