From 5f1cad86330821559696952b89b02a14394155bf Mon Sep 17 00:00:00 2001 From: Ian Rees Date: Wed, 4 Dec 2024 21:53:02 -0800 Subject: [PATCH] Additional UnmarshalJSON fixes --- go.mod | 2 +- go.sum | 4 ++-- tt/geom.go | 3 +++ tt/seconds.go | 3 +++ 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index bc0f29e3..e95bd5e4 100644 --- a/go.mod +++ b/go.mod @@ -68,7 +68,7 @@ require ( golang.org/x/crypto v0.24.0 // indirect golang.org/x/net v0.26.0 // indirect golang.org/x/sync v0.7.0 // indirect - golang.org/x/sys v0.27.0 // indirect + golang.org/x/sys v0.28.0 // indirect golang.org/x/text v0.16.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 46826962..8080332c 100644 --- a/go.sum +++ b/go.sum @@ -206,8 +206,8 @@ golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.27.0 h1:wBqf8DvsY9Y/2P8gAfPDEYNuS30J4lPHJxXSb/nJZ+s= -golang.org/x/sys v0.27.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA= +golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= diff --git a/tt/geom.go b/tt/geom.go index e9807d9e..2b07c317 100644 --- a/tt/geom.go +++ b/tt/geom.go @@ -71,6 +71,9 @@ func (g *GeometryOption[T]) Scan(src interface{}) error { } func (g *GeometryOption[T]) UnmarshalJSON(data []byte) error { + if string(data) == "null" { + return nil + } return g.Scan(data) } diff --git a/tt/seconds.go b/tt/seconds.go index b7b9c1d7..c33c5969 100644 --- a/tt/seconds.go +++ b/tt/seconds.go @@ -81,6 +81,9 @@ func (r *Seconds) Scan(src interface{}) error { } func (r *Seconds) UnmarshalJSON(d []byte) error { + if string(d) == "null" { + return nil + } return r.Scan(string(stripQuotes(d))) }