vapor / fluent-kit

Swift ORM (queries, models, and relations) for NoSQL and SQL databases
MIT License
218 stars 116 forks source link

Consider adding a page count to Page or PageMetadata #481

Closed fwgreen closed 2 years ago

fwgreen commented 2 years ago

Knowing the page count once you've set the page request comes in handy. My current workaround is a tiny extension:

extension Page {
    var pageCount: Int {
        Int((Double(self.metadata.total)/Double(self.metadata.per)).rounded(.up))
    }
}