Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dynamodb/attributevalue: Encode map[string]struct{} as StringSet, not just []string #646

Closed
finnbear opened this issue Jul 15, 2020 · 1 comment
Labels
closed-for-staleness feature-request A feature should be added or improved.

Comments

@finnbear
Copy link

finnbear commented Jul 15, 2020

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.

https://www.davidkaya.com/sets-in-golang/

Originally filed under V1: aws/aws-sdk-go#3408

https://github.com/guregu/dynamo supports this.

@finnbear finnbear added the feature-request A feature should be added or improved. label Jul 15, 2020
@jasdel 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
@github-actions
Copy link

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.

@github-actions github-actions bot added closing-soon This issue will automatically close in 4 days unless further comments are made. closed-for-staleness and removed closing-soon This issue will automatically close in 4 days unless further comments are made. labels Nov 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-for-staleness feature-request A feature should be added or improved.
Projects
None yet
Development

No branches or pull requests

1 participant