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: Add AttributeValue marshaler utilities #895

Closed
2 of 8 tasks
jasdel opened this issue Nov 11, 2020 · 2 comments · Fixed by #948
Closed
2 of 8 tasks

dynamodb/attributevalue: Add AttributeValue marshaler utilities #895

jasdel opened this issue Nov 11, 2020 · 2 comments · Fixed by #948
Labels
feature-request A feature should be added or improved.

Comments

@jasdel
Copy link
Contributor

jasdel commented Nov 11, 2020

The DynamodB attribute value marshaler utilities in the v1 SDK's /service/dynamodb/dynamoattributevalue package were removed in the v0.25.0 update. These utilities need to be brought back, and reintroduced to the updated SDK, and refactored for the SDK's list, map, and union representations.

Blocking issues

Related issues

Related Concerns

  • How should attribute value marshaler handle DynamoDB streams vs regular Dynamodb attribute values types?
@jasdel jasdel added the feature-request A feature should be added or improved. label Nov 11, 2020
@jasdel jasdel added this to the v1.0 Release Candidate milestone Nov 11, 2020
jasdel added a commit to jasdel/aws-sdk-go-v2 that referenced this issue Dec 5, 2020
* Fixes aws#895
* Fixes aws#929
* Fixes aws#115 to encode `null` for nil map/slice unless `omitempty` is
  set. Simplifies the rules of `null` vs skipped vs zero value for all
  types.
jasdel added a commit to jasdel/aws-sdk-go-v2 that referenced this issue Dec 8, 2020
* Fixes aws#895
* Fixes aws#929
* Fixes aws#115 to encode `null` for nil map/slice unless `omitempty` is
  set. Simplifies the rules of `null` vs skipped vs zero value for all
  types.
jasdel added a commit to jasdel/aws-sdk-go-v2 that referenced this issue Dec 9, 2020
Adds support for

* Fixes aws#895 - Add support for attribute value marshaling
* Fixes aws#929 - Support Number type aliases of string for support for
  json.Number like types.
* Fixes aws#115 - Simplifies the rules of `null` vs skipped vs zero value
  for all types.
  * All nil pointers, map, slice members are serialized as NULL.
  * omitempty struct tag skips zero value of members with the struct
    tag.
  * Empty and Nil Sets (NS, BS, SS) are serialized to null
    by default unless `NullEmptySets` EncoderOptions is set to false. True
    by default. Nil sets are always serialized as NULL, unless the
    `omitempty` struct tag is used.
  * Adds `nullempty` and `nullemptyelem` struct tags to direct if the
    encoder should marshal the member as a AttributeValue NULL if the
    member's value is the type's zero value, (e.g. "" for string, 0 for
    number, nil for pointer/map/slice, false for bool)
jasdel added a commit to jasdel/aws-sdk-go-v2 that referenced this issue Dec 9, 2020
Adds support for

* Fixes aws#895 - Add support for attribute value marshaling
* Fixes aws#929 - Support Number type aliases of string for support for
  json.Number like types.
* Fixes aws#115 - Simplifies the rules of `null` vs skipped vs zero value
  for all types.
  * All nil pointers, map, slice members are serialized as NULL.
  * omitempty struct tag skips zero value of members with the struct
    tag.
  * Empty and Nil Sets (NS, BS, SS) are serialized to null
    by default unless `NullEmptySets` EncoderOptions is set to false. True
    by default. Nil sets are always serialized as NULL, unless the
    `omitempty` struct tag is used.
  * Adds `nullempty` and `nullemptyelem` struct tags to direct if the
    encoder should marshal the member as a AttributeValue NULL if the
    member's value is the type's zero value, (e.g. "" for string, 0 for
    number, nil for pointer/map/slice, false for bool)
jasdel added a commit to jasdel/aws-sdk-go-v2 that referenced this issue Dec 11, 2020
Adds support for

* Fixes aws#895 - Add support for attribute value marshaling
* Fixes aws#929 - Support Number type aliases of string for support for
  json.Number like types.
* Fixes aws#115 - Simplifies the rules of `null` vs skipped vs zero value
  for all types.
  * All nil pointers, map, slice members are serialized as NULL.
  * omitempty struct tag skips zero value of members with the struct
    tag.
  * Empty and Nil Sets (NS, BS, SS) are serialized to null
    by default unless `NullEmptySets` EncoderOptions is set to false. True
    by default. Nil sets are always serialized as NULL, unless the
    `omitempty` struct tag is used.
  * Adds `nullempty` and `nullemptyelem` struct tags to direct if the
    encoder should marshal the member as a AttributeValue NULL if the
    member's value is the type's zero value, (e.g. "" for string, 0 for
    number, nil for pointer/map/slice, false for bool)
jasdel added a commit to jasdel/aws-sdk-go-v2 that referenced this issue Dec 14, 2020
Adds support for

* Fixes aws#895 - Add support for attribute value marshaling
* Fixes aws#929 - Support Number type aliases of string for support for
  json.Number like types.
* Fixes aws#115 - Simplifies the rules of `null` vs skipped vs zero value
  for all types.
  * All nil pointers, map, slice members are serialized as NULL.
  * omitempty struct tag skips zero value of members with the struct
    tag.
  * Empty and Nil Sets (NS, BS, SS) are serialized to null
    by default unless `NullEmptySets` EncoderOptions is set to false. True
    by default. Nil sets are always serialized as NULL, unless the
    `omitempty` struct tag is used.
  * Adds `nullempty` and `nullemptyelem` struct tags to direct if the
    encoder should marshal the member as a AttributeValue NULL if the
    member's value is the type's zero value, (e.g. "" for string, 0 for
    number, nil for pointer/map/slice, false for bool)
jasdel added a commit to jasdel/aws-sdk-go-v2 that referenced this issue Dec 15, 2020
Adds support for

* Fixes aws#895 - Add support for attribute value marshaling
* Fixes aws#929 - Support Number type aliases of string for support for
  json.Number like types.
* Fixes aws#115 - Simplifies the rules of `null` vs skipped vs zero value
  for all types.
  * All nil pointers, map, slice members are serialized as NULL.
  * omitempty struct tag skips zero value of members with the struct
    tag.
  * Empty and Nil Sets (NS, BS, SS) are serialized to null
    by default unless `NullEmptySets` EncoderOptions is set to false. True
    by default. Nil sets are always serialized as NULL, unless the
    `omitempty` struct tag is used.
  * Adds `nullempty` and `nullemptyelem` struct tags to direct if the
    encoder should marshal the member as a AttributeValue NULL if the
    member's value is the type's zero value, (e.g. "" for string, 0 for
    number, nil for pointer/map/slice, false for bool)
jasdel added a commit that referenced this issue Dec 15, 2020
…948)

Adds utilities for mapping Amazon DynamoDB API AttributeValue to and from Go types.

* Adds conversion util for DynamoDB  -> DynamoDBStreams AttributeValue.

* Fixes #895 -  Adds back marshaler/unmarshalers for attribute value to/from go types.
* Fixes #929 - Adds generic support for `json.Number` like types that are aliases of `string`s.
* Fixes #115 - Simplifies the rules of `null` vs skipped vs zero value
  for all types. 
  * All nil pointers, map, slice members are serialized as NULL AttributeValue.
  * `omitempty` struct tag skips zero value of members with the struct tag. `omitemptyelem` skips elements of list/map that have zero value. 
  * `nullempty` struct tag serializes zero value of members with the struct tag as NULL AttributeValue. `nullemptyelem` does same for elements of list/map that have zero value.
  * Empty and Nil Sets (NS, BS, SS) are serialized to null by default unless `NullEmptySets` EncoderOptions is set to false. True by default. Nil sets are always serialized as NULL, unless the`omitempty` struct tag is used.
  * Adds `nullempty` and `nullemptyelem` struct tags to direct if the encoder should marshal the member as a AttributeValue NULL if the member's value is the type's zero value, (e.g. "" for string, 0 for number, nil for pointer/map/slice, false for bool)
@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

@frioux
Copy link

frioux commented May 18, 2022

For future people ending up here:

https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/feature/dynamodb/attributevalue#hdr-AttributeValue_Marshaling

import "github.com/aws/aws-sdk-go-v2/feature/dynamodb/attributevalue"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request A feature should be added or improved.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants