diff options
| author | Shulhan <ms@kilabit.info> | 2026-04-13 03:12:16 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2026-04-13 04:27:12 +0700 |
| commit | a7e8750d5b83f390afec2333350a7293917dee12 (patch) | |
| tree | 75a325840236758d04a31c41182b02a31dc4217b /lib/uuidv7/uuid_test.go | |
| parent | beccc10bc2fd1b80134c7acd5e180b9d31c7fb4e (diff) | |
| download | pakakeh.go-a7e8750d5b83f390afec2333350a7293917dee12.tar.xz | |
lib/uuid: return nil if ID is zero
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.
Diffstat (limited to 'lib/uuidv7/uuid_test.go')
| -rw-r--r-- | lib/uuidv7/uuid_test.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/uuidv7/uuid_test.go b/lib/uuidv7/uuid_test.go index 4972a70c..c47806d8 100644 --- a/lib/uuidv7/uuid_test.go +++ b/lib/uuidv7/uuid_test.go @@ -156,7 +156,7 @@ func TestUUID_Value(t *testing.T) { if err != nil { t.Fatal(err) } - test.Assert(t, `ValueZero`, v.(string), `00000000-0000-0000-0000-000000000000`) + test.Assert(t, `ValueZero`, nil, v) err = id.Scan([]byte(`019CD2F8-1AE3-774E-BFFF-FFFFFFFFFFFF`)) if err != nil { |
