Skip to content

Commit

Permalink
page -1 indicates not pagination
Browse files Browse the repository at this point in the history
  • Loading branch information
wubin48435 committed Jul 22, 2024
1 parent 3788bf4 commit deb8c64
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions toolkit/pagination/gorm/paginate.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,11 @@ func (r *resContext) Response(res interface{}) Page {
Unscoped().
Table("(?) AS s1", result)

result = result.Count(&page.Total).
Limit(int(causes.Limit)).
Offset(int(causes.Offset))
if pr.Page >= 0 {
result = result.Count(&page.Total).
Limit(int(causes.Limit)).
Offset(int(causes.Offset))
}
if result.Error != nil {
r.error = result.Error
return page
Expand Down

0 comments on commit deb8c64

Please sign in to comment.