Skip to content

Commit

Permalink
Change count logic remove id
Browse files Browse the repository at this point in the history
  • Loading branch information
Dodi Triwibowo committed May 23, 2020
1 parent 275ff8e commit 4795f94
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions paginator/pagination.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,7 @@ func Paginate(p *Param, result interface{}) *Pagination {
} else {
offset = (p.Page - 1) * p.Limit
}
var ids []uint
db.Limit(p.Limit).Offset(offset).Find(result).Pluck("id", &ids)
countInPage = len(ids)
db.Limit(p.Limit).Offset(offset).Find(result).Count(&countInPage)
<-done

paginate.FirstPageUrl = fmt.Sprintf("%s%s?page=%d", p.Req.Host, p.Req.URL.Path, 1)
Expand Down

0 comments on commit 4795f94

Please sign in to comment.