Add handling for empty Jsonb to fix #1649 (#1650)

This commit is contained in:
daisy1754 2018-02-09 05:59:33 -08:00 committed by Jinzhu
parent 48e41440af
commit 38f96c6514
1 changed files with 3 additions and 0 deletions

View File

@ -63,6 +63,9 @@ type Jsonb struct {
// Value get value of Jsonb
func (j Jsonb) Value() (driver.Value, error) {
if len(j.RawMessage) == 0 {
return nil, nil
}
return j.MarshalJSON()
}