aboutsummaryrefslogtreecommitdiff
path: root/lib/uuidv7
AgeCommit message (Collapse)Author
2 dayslib/uuid: return nil if ID is zeroShulhan
Per RFC 9562 Section 5.9, A Nil UUID value can be useful to communicate the absence of any other UUID value in situations that otherwise require or use a 128-bit UUID. A Nil UUID can express the concept "no such value here". Thus, it is reserved for such use as needed for implementation-specific situations. In case of SQL, the Value method should return nil if ID is zero.
9 dayslib/uuidv7: add tests for Equal and ValueShulhan
9 dayslib/uuidv7: add suffix Func to Now and RandShulhan
Using Func suffix to function variable is common coding styles in Go.
9 dayslib/uuidv7: remove the v7 suffix from typeShulhan
Adding suffix version to the type seems not right (and also mouthful to read) since the package already defines the version of UUID.
10 dayslib/uuidv7: add method IsEqualShulhan
This is to simplify checking for equality in if-condition.
11 dayslib/uuidv7: changes the value only when unmarshal or scan successShulhan
If the UUID value being unmarshaled or scanned is not valid, don't changes the current value.
11 dayslib/uuidv7: detect nil value on ScanShulhan
Column with NULL value will returns no error but zero UUID.
2026-03-26lib/uuidv7: implements method Value from [driver.Valuer]Shulhan
The Value method returns the value for sending it to the database.
2026-03-26lib/uuidv7: implement Equal method for [lib/reflect.Equaler]Shulhan
The Equal method returns nil if both receiver and parameter has the same value. This method implements [lib/reflect.Equaler] interface.
2026-03-10lib/uuidv7: new package that implements UUID version 7Shulhan
The uuidv7 package provides type UUIDv7 as the container for UUID version 7 that satisfy the [database/sql], [encoding/gob], and [encoding/json]. The implementation follow RFC 9562.