From a3267013b72eec0eddbcd1949b0900b0ca56cb6d Mon Sep 17 00:00:00 2001 From: Lanre Ade Date: Sun, 3 Mar 2019 16:33:54 -0700 Subject: [PATCH] Update decimal.go --- decimal.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/decimal.go b/decimal.go index 134ece2..78e16ad 100644 --- a/decimal.go +++ b/decimal.go @@ -970,6 +970,11 @@ func (d Decimal) MarshalBinary() (data []byte, err error) { // Scan implements the sql.Scanner interface for database deserialization. func (d *Decimal) Scan(value interface{}) error { + if value == nil { + d = nil + return nil + } + // first try to see if the data is stored in database as a Numeric datatype switch v := value.(type) {