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

Implement NullUUID #54

Closed
pmalekn opened this issue Mar 11, 2020 · 6 comments
Closed

Implement NullUUID #54

pmalekn opened this issue Mar 11, 2020 · 6 comments

Comments

@pmalekn
Copy link

pmalekn commented Mar 11, 2020

In order to allow uuid.UUID to work with the standard sql package to represent a UUID value that can be NULL in the database I suggest to implement a NullUUID the same way as
it's done in http://github.com/satori/go.uuid [1]

[1] https://pkg.go.dev/github.com/satori/go.uuid@v1.2.0?tab=doc#NullUUID

@pborman
Copy link
Collaborator

pborman commented Mar 12, 2020

Looking at the code it appears that NullUUID can actually be implemented outside of the uuid package itself. Have you considered making a simple package that provides this type?

@pmalekn
Copy link
Author

pmalekn commented Mar 12, 2020

Ha! Didn't think about this obvious solution.
Still it would be nice to implement it in here to make it more idiomatic.
Instead of importing a separate package and calling a type e.g. null.UUID we could use the very same package that defines the uuid.UUID and use the type as uuid.Null.

I'd be happy to submit a PR basing the work on satori's implementation.

@agravelot
Copy link

This issue seems to be fixed, am I wrong?

@Alcas1
Copy link

Alcas1 commented Mar 10, 2022

Should be able to close this one

@jensilo
Copy link

jensilo commented Jul 9, 2024

Just as I've stumbled across this personally as well, FYI there is a generic sql.Null[T].

@pmalekn
Copy link
Author

pmalekn commented Jul 9, 2024

Looks like #76 solved this and this change got released in 1.3.0: https://github.com/google/uuid/releases/tag/v1.3.0 🎉

@pmalekn pmalekn closed this as completed Jul 9, 2024
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

No branches or pull requests

5 participants