Skip to content

Commit

Permalink
count出错的时候停止并报错
Browse files Browse the repository at this point in the history
  • Loading branch information
tobycroft committed Sep 20, 2022
1 parent eb7534f commit 7e13706
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions orm_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -522,9 +522,10 @@ func (dba *Orm) Paginator(page ...int) (res Paginate, err error) {
prefix := dba.GetISession().GetIBinder().GetBindPrefix()
where := dba.where
fields := dba.fields
resData, err := dba.Get()
resData, err1 := dba.Get()
//fmt.Println(dba.LastSql())
if err != nil {
err = err1
return
}
dba.offset = 0
Expand All @@ -533,8 +534,11 @@ func (dba *Orm) Paginator(page ...int) (res Paginate, err error) {
dba.GetISession().GetIBinder().SetBindPrefix(prefix)
dba.where = where

count, err := dba.Counts()

count, err2 := dba.Counts()
if err != nil {
err = err2
return
}
//fmt.Println(dba.LastSql())

var lastPage = int(math.Ceil(float64(count) / float64(limit)))
Expand Down

0 comments on commit 7e13706

Please sign in to comment.