Skip to content

Commit

Permalink
Allow to support other field types
Browse files Browse the repository at this point in the history
  • Loading branch information
jinzhu committed Jun 20, 2024
1 parent 109f239 commit 4f62911
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion schema/serializer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 4f62911

Please sign in to comment.