We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
proc paginate*(this:RDB, display:int, page:int=1): JsonNode = if not page > 0: raise newException(Exception, "arg2 should be larger than 0") let total = this.count() let offset = (page - 1) * display let currentPage = this.limit(display).offset(offset).get() let count = currentPage.len() let hasMorePages = if page * display < total: true else: false let lastPage = int(total / display) let nextPage = if page + 1 <= lastPage: page + 1 else: lastPage let perPage = display let previousPage = if page - 1 > 0: page - 1 else: 1 return %*{ "count": count, "currentPage": currentPage, "hasMorePages": hasMorePages, "lastPage": lastPage, "nextPage": nextPage, "perPage": perPage, "previousPage": previousPage, "total": total }
https://github.com/itsumura-h/nim-allographer/blob/3f2eff06dfec829ad68038a133a691945fb58219/src/allographer/query_builder/exec.nim
The text was updated successfully, but these errors were encountered:
No branches or pull requests
https://github.com/itsumura-h/nim-allographer/blob/3f2eff06dfec829ad68038a133a691945fb58219/src/allographer/query_builder/exec.nim
The text was updated successfully, but these errors were encountered: