Closed pmalekn closed 2 months ago
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?
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.
This issue seems to be fixed, am I wrong?
Should be able to close this one
Just as I've stumbled across this personally as well, FYI there is a generic sql.Null[T]
.
Looks like #76 solved this and this change got released in 1.3.0: https://github.com/google/uuid/releases/tag/v1.3.0 🎉
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 aNullUUID
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