Allow to support other field types

This commit is contained in:
Jinzhu 2024-06-20 16:45:38 +08:00
parent 109f239fae
commit 4f6291154b
1 changed files with 4 additions and 1 deletions

View File

@ -84,7 +84,10 @@ func (JSONSerializer) Scan(ctx context.Context, field *Field, dst reflect.Value,
case string:
bytes = []byte(v)
default:
return fmt.Errorf("failed to unmarshal JSONB value: %#v", dbValue)
bytes, err = json.Marshal(v)
if err != nil {
return err
}
}
if len(bytes) > 0 {