fixes in selectPaginated

This commit is contained in:
2022-08-30 15:20:45 +06:00
parent 03c8830672
commit b165a76e62
2 changed files with 20 additions and 15 deletions

View File

@@ -4,11 +4,7 @@ import org.jetbrains.exposed.sql.*
fun Query.paginate(with: Pagination, orderBy: Pair<Expression<*>, SortOrder>? = null) = limit(
with.size,
(if (orderBy ?.second == SortOrder.DESC) {
with.lastIndex
} else {
with.firstIndex
}).toLong()
with.firstIndex.toLong()
).let {
if (orderBy != null) {
it.orderBy(