datatypes icon indicating copy to clipboard operation
datatypes copied to clipboard

null 会被写入成 'null',会无法反序列化,需要添加或 判断string(j) == "null"

Open kkv0id opened this issue 4 years ago • 0 comments

func (j RawJson) Value() (driver.Value, error) {
	if len(j) == 0 || string(j) == "null" {
		return nil, nil
	}
	bytes, err := j.MarshalJSON()
	return string(bytes), err
}

kkv0id avatar Aug 26 '21 13:08 kkv0id