From a0dffb625d35c62bb968844ef95038649530c1fa Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Wed, 8 Dec 2021 16:18:44 +0800 Subject: [PATCH] Fix bug --- session_find.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/session_find.go b/session_find.go index b91bf6e8..dcac93b7 100644 --- a/session_find.go +++ b/session_find.go @@ -71,7 +71,11 @@ func (session *Session) FindAndCount(rowsSlicePtr interface{}, condiBean ...inte } // session has stored the conditions so we use `unscoped` to avoid duplicated condition. - return session.Unscoped().Count(reflect.New(sliceElementType).Interface()) + if sliceElementType.Kind() == reflect.Struct { + return session.Unscoped().Count(reflect.New(sliceElementType).Interface()) + } + + return session.Unscoped().Count() } func (session *Session) find(rowsSlicePtr interface{}, condiBean ...interface{}) error {