From 9ff5f3970146c7dabf7159b53d9f523e8b4da239 Mon Sep 17 00:00:00 2001 From: qinyuguang Date: Mon, 11 Apr 2022 23:45:11 +0800 Subject: [PATCH 1/2] fix issue #1747 --- encoding/gjson/gjson_implements.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/encoding/gjson/gjson_implements.go b/encoding/gjson/gjson_implements.go index 36dd0545f..2e9b547dc 100644 --- a/encoding/gjson/gjson_implements.go +++ b/encoding/gjson/gjson_implements.go @@ -26,7 +26,9 @@ func (j *Json) UnmarshalJSON(b []byte) error { // UnmarshalValue is an interface implement which sets any type of value for Json. func (j *Json) UnmarshalValue(value interface{}) error { - if r := New(value); r != nil { + if r := NewWithOptions(value, Options{ + StrNumber: true, + }); r != nil { // Value copy. *j = *r } From c5bf45f1aef22665f1204699ad7d14cf16b98aa9 Mon Sep 17 00:00:00 2001 From: qinyuguang Date: Wed, 13 Apr 2022 21:49:08 +0800 Subject: [PATCH 2/2] fix issue #1755 --- database/gdb/gdb_model_cache.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/database/gdb/gdb_model_cache.go b/database/gdb/gdb_model_cache.go index dac5040db..d63eb4d74 100644 --- a/database/gdb/gdb_model_cache.go +++ b/database/gdb/gdb_model_cache.go @@ -86,9 +86,13 @@ func (m *Model) getSelectResultFromCache(ctx context.Context, sql string, args . if cacheItem, ok = v.Val().(*selectCacheItem); ok { // In-memory cache. return cacheItem.Result, nil - } else if err = json.UnmarshalUseNumber(v.Bytes(), &cacheItem); err != nil { + } else { // Other cache, it needs conversion. - return nil, err + err = json.UnmarshalUseNumber(v.Bytes(), &cacheItem) + if err != nil { + return nil, err + } + return cacheItem.Result, nil } } return