db
db copied to clipboard
TotalEntries and TotalPages are always 1 with SQLite
paginator := session.SQL().Select(.....).Where(...).Paginate(10)
err := paginator.Page(uint(page)).All(&books)
if err != nil {
return 0, nil
}
// the total here is always 1
total, err := paginator.TotalPages()
if err != nil {
return 0, err
}
but it's correct if with:
paginator := session.Collection("book").Find().Paginate(10)
// the total is correct
total, err := paginator.TotalPages()
if err != nil {
return 0, err
}
Hello @coolerfall,
I could not replicate this issue, I added an additional test for the paginator here: https://github.com/upper/db/pull/609
Could you provide more data on how to replicate?
@xiam I worked with v4.4.0. I select record with SQL() and got 10 records for example, but TotalEntries() give me 1, and TotalPages is 1 too.