mirror of
https://gitee.com/johng/gf
synced 2026-07-04 21:03:13 +08:00
Merge branch 'develop' of https://github.com/gogf/gf into develop
This commit is contained in:
@ -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
|
||||
|
||||
@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user