From 4f6291154b3c0a2e8d8158232709e381a484c5cf Mon Sep 17 00:00:00 2001 From: Jinzhu Date: Thu, 20 Jun 2024 16:45:38 +0800 Subject: [PATCH] Allow to support other field types --- schema/serializer.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/schema/serializer.go b/schema/serializer.go index f500521ef7..0fafbcba07 100644 --- a/schema/serializer.go +++ b/schema/serializer.go @@ -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 {