From ad2ec68c34c6a3cba6ba9bb2848ed2f6c2e82c66 Mon Sep 17 00:00:00 2001 From: "Gerasimos (Makis) Maropoulos" Date: Mon, 29 Nov 2021 12:54:27 +0200 Subject: [PATCH] handle null sql iso8601, kitchen time and simple date column values --- x/jsonx/iso8601.go | 2 ++ x/jsonx/kitchen_time.go | 2 ++ x/jsonx/simple_date.go | 2 ++ 3 files changed, 6 insertions(+) diff --git a/x/jsonx/iso8601.go b/x/jsonx/iso8601.go index 464dba73..c5d22b8e 100644 --- a/x/jsonx/iso8601.go +++ b/x/jsonx/iso8601.go @@ -104,6 +104,8 @@ func (t *ISO8601) Scan(src interface{}) error { return err } *t = tt + case nil: + *t = ISO8601(time.Time{}) default: return fmt.Errorf("ISO8601: unknown type of: %T", v) } diff --git a/x/jsonx/kitchen_time.go b/x/jsonx/kitchen_time.go index 12197718..35f8a16c 100644 --- a/x/jsonx/kitchen_time.go +++ b/x/jsonx/kitchen_time.go @@ -100,6 +100,8 @@ func (t *KitckenTime) Scan(src interface{}) error { return err } *t = tt + case nil: + *t = KitckenTime(time.Time{}) default: return fmt.Errorf("KitckenTime: unknown type of: %T", v) } diff --git a/x/jsonx/simple_date.go b/x/jsonx/simple_date.go index df8d20e9..cb56cd9d 100644 --- a/x/jsonx/simple_date.go +++ b/x/jsonx/simple_date.go @@ -105,6 +105,8 @@ func (t *SimpleDate) Scan(src interface{}) error { return err } *t = tt + case nil: + *t = SimpleDate(time.Time{}) default: return fmt.Errorf("SimpleDate: unknown type of: %T", v) }