-
Notifications
You must be signed in to change notification settings - Fork 114
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
Add JSON (Un)marshaling methods on NullUUID type #38
Conversation
This is part of #32. |
Pull Request Test Coverage Report for Build 116
💛 - Coveralls |
d036565
to
a491b52
Compare
1cfa150
to
ebf8642
Compare
ebf8642
to
9ad4bb4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice!
This commit adapts satori/go.uuid#44 for our fork of the original project. This brings JSON Marshaling and Unmarshaling to the `uuid.NullUUID` type used for use with SQL databases. This is needed because `uuid.NullUUID` is a shim around `uuid.UUID`, providing the information needed by the `database/sql` package to support storing the value in a nullable column. Without these methods, the type gets converted unnecessarily to a different format than the standard `uuid.UUID` type. Signed-off-by: Tim Heckman <t@heckman.io>
9ad4bb4
to
a30993e
Compare
Add JSON (Un)marshaling methods on NullUUID type Signed-off-by: Tim Heckman <t@heckman.io>
This is going to actually warrant a 3.0.0. I think changing how this serializes to JSON could be a breaking change. |
Should summary issue #32 be updated to mark this as merged? |
Came here late from the original repo, thanks for taking over maintenance. Out of curiosity, why did you put the JSON marshaller into |
@philippfrank I assume this was to have it alongside the NullUUID struct without thinking about how basically every file is mostly methods on that same struct for this particular project. I could see it being more appropriate in codec.go though. Is that where you had in mind as the sensible place to put it? |
This commit adapts satori/go.uuid#44 for our fork of the
original project. This brings JSON Marshaling and Unmarshaling to the
uuid.NullUUID
type used for use with SQL databases.This is needed because
uuid.NullUUID
is a shim arounduuid.UUID
, providingthe information needed by the
database/sql
package to support storing thevalue in a nullable column. Without these methods, the type gets converted
unnecessarily to a different format than the standard
uuid.UUID
type.