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: Marshal does not support json.Number to Numeric data type #929

Closed
KaibaLopez opened this issue Nov 24, 2020 · 1 comment · Fixed by #948
Closed
Labels
feature-request A feature should be added or improved.

Comments

@KaibaLopez
Copy link
Contributor

Is your feature request related to a problem? Please describe.
The deprecated dynamodbattribute.ConvertTo(...) has broader functionality than the new dynamdbattribute.Marshal(...).

Describe the solution you'd like
Ideally, the new function should be able to convert json.Number type to the numeric dynamodb data type N or the sdk should have another non-deprecated function for making that conversion.

Additional context
Refer to V1 issue #3643 for code samples and explanation.

@KaibaLopez KaibaLopez added the feature-request A feature should be added or improved. label Nov 24, 2020
@jasdel jasdel changed the title dynamodbattribute.Marshal() does not marshal json.Number to Numeric data type dynamodb/attributevalue: Marshal does not support json.Number to Numeric data type Nov 30, 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.

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.

1 participant