fix bug on findandcount

This commit is contained in:
Lunny Xiao 2018-02-24 15:51:35 +08:00
parent cea778734c
commit e54b9addeb
No known key found for this signature in database
GPG Key ID: C3B7C91B632F738A
1 changed files with 3 additions and 0 deletions

View File

@ -47,6 +47,9 @@ func (session *Session) FindAndCount(rowsSlicePtr interface{}, condiBean ...inte
} }
sliceElementType := sliceValue.Type().Elem() sliceElementType := sliceValue.Type().Elem()
if sliceElementType.Kind() == reflect.Ptr {
sliceElementType = sliceElementType.Elem()
}
session.autoResetStatement = true session.autoResetStatement = true
return session.Count(reflect.New(sliceElementType).Interface()) return session.Count(reflect.New(sliceElementType).Interface())