v3.0.0 denotes the first major change by The Gofrs, and encompasses feature requests / PRs that had been opened against the original project. This version includes the following breaking changes:
- update the
sql.NullUUIDtype to support both thejson.Marshalerandjson.Unmarshalerinterfaces, which I'll provide more details on later. (#38) - remove the
Equalfunction from the package, as the UUID type is an array type and so you can use==directly for comparisons. (#36 #39)
This version also exposes the internal UUID generator, with constructors, so that consumers can provide their own HWAddrFunc to get the hardware address of the node. This can be used by consumers who want to randomize the MAC address in a V1 UUID. (#42)
In regards to the JSON change, the sql.NullUUID type is one that's used with
the database/sql package to support columns that can contain UUIDs or a NULL
value. This means it's a struct with a UUID and Valid field, so previously a
sql.NullUUID would marshal to JSON like so:
{
"uuid": {
"uuid": "3bdef553-9b6a-4620-8a5f-b94bf22a2520",
"valid": true
}
}By implementing the right interfaces from the JSON package, it'll now marshal like so:
{
"uuid": "3bdef553-9b6a-4620-8a5f-b94bf22a2520"
}