From e47a73bf81b1b2c5fa846b501105a79607e3a691 Mon Sep 17 00:00:00 2001 From: Alireza Khojastehfar Date: Mon, 19 Aug 2024 17:29:39 +0330 Subject: [PATCH] Bug fix: Add matching case for nil uuid column Schemagen generates structs as [16]byte for uuid and timeuuid columns. when a time/uuid column has nil value, the switch case will not match with *[]byte and returns the following error: `can not unmarshal X timeuuid into *[16]uint8` to solve this we can change Schemagen, or add the case here. personally I belive changing Schemagen has more cost and mapping UUIDs to [16]byte is better than mapping to []byte. --- marshal.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/marshal.go b/marshal.go index 6edd78ac0..7d327efcf 100644 --- a/marshal.go +++ b/marshal.go @@ -1865,6 +1865,8 @@ func unmarshalUUID(info TypeInfo, data []byte, value interface{}) error { *v = "" case *[]byte: *v = nil + case *[16]byte: + *v = [16]byte{} case *UUID: *v = UUID{} default: