go-gorm/datatypes

Regression in datatypes/json v1.0.4 with empty or nil values

f-blass opened this issue · 1 comments

GORM Playground Link

go-gorm/playground#409

Description

With https://github.com/go-gorm/datatypes@v1.0.4 JSON values have unexpected behaviours when nil or empty.

If the datatypes.JSON var is nil, GORM will now insert a string "null" into the database instead of an actual null value.
If the datatypes.JSON var is empty (empty byte array) GORM tries to insert an empty string "", which fails.

fix it please @jinzhu