Judge both type of struct and pointer in case of out-of-range
This commit is contained in:
parent
f1e89c225d
commit
7fc1fe6524
|
@ -398,11 +398,12 @@ func (session *Session) cacheFind(t reflect.Type, sqlStr string, rowsSlicePtr in
|
||||||
bean := cacher.GetBean(tableName, sid)
|
bean := cacher.GetBean(tableName, sid)
|
||||||
|
|
||||||
// fix issue #894
|
// fix issue #894
|
||||||
ckt := t
|
ckb := reflect.ValueOf(bean).Elem().Type()
|
||||||
if ckt.Kind() == reflect.Ptr {
|
ht := ckb == t
|
||||||
ckt = t.Elem()
|
if !ht && t.Kind() == reflect.Ptr {
|
||||||
|
ht = t.Elem() == ckb
|
||||||
}
|
}
|
||||||
if bean == nil || reflect.ValueOf(bean).Elem().Type() != ckt {
|
if bean == nil || !ht {
|
||||||
ides = append(ides, id)
|
ides = append(ides, id)
|
||||||
ididxes[sid] = idx
|
ididxes[sid] = idx
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue