-
Notifications
You must be signed in to change notification settings - Fork 615
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: Consider changing default behavior for empty maps and slices #115
Comments
Example of current workaround, https://play.golang.org/p/RQtGrPP8ee6 |
+1 for this request. I would like to store empty arrays as such |
1 similar comment
+1 for this request. I would like to store empty arrays as such |
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)
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)
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)
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)
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)
…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)
|
aws/aws-sdk-go#682 raised an issue that the SDK's dynamodbattribute.Marshal methods will marshal empty slices and maps as
NULL
. This makes is cumbersome to intentionally have the values marshaled as empty list or map.Consider if it makes sense to change the logic, so that a non-nil slice/map will marshal to a empty list
av.L = []dynamodb.AttributeValue{}
or map.av.M = map[string]dynamodb.AttributeValue{}
.nil
maps or slices would still be marshaled asav.NULL = true
.Issue identified in gitter where using an empty list with the
expressions
Update caused unexpected errors.The text was updated successfully, but these errors were encountered: