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

Add JSON (Un)marshaling methods on NullUUID type #38

Merged
merged 2 commits into from
Jul 23, 2018

Conversation

theckman
Copy link
Member

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.

@theckman
Copy link
Member Author

This is part of #32.

@coveralls
Copy link

coveralls commented Jul 23, 2018

Pull Request Test Coverage Report for Build 116

  • 16 of 16 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.04%) to 99.107%

Totals Coverage Status
Change from base Build 104: 0.04%
Covered Lines: 333
Relevant Lines: 336

💛 - Coveralls

@theckman theckman removed the WIP label Jul 23, 2018
@theckman theckman force-pushed the satori_go.uuid_44_adaption branch 2 times, most recently from 1cfa150 to ebf8642 Compare July 23, 2018 01:57
@theckman theckman added this to the 2.2.0 milestone Jul 23, 2018
Copy link
Member

@niaow niaow left a 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>
@theckman theckman merged commit a30993e into master Jul 23, 2018
theckman added a commit that referenced this pull request Jul 23, 2018
Add JSON (Un)marshaling methods on NullUUID type

Signed-off-by: Tim Heckman <t@heckman.io>
@theckman
Copy link
Member Author

This is going to actually warrant a 3.0.0. I think changing how this serializes to JSON could be a breaking change.

@theckman theckman modified the milestones: 2.2.0, 3.0.0 Jul 28, 2018
@PaluMacil
Copy link

Should summary issue #32 be updated to mark this as merged?

@philippfrank
Copy link

Came here late from the original repo, thanks for taking over maintenance. Out of curiosity, why did you put the JSON marshaller into sql.go?

@PaluMacil
Copy link

@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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants