mirror of
https://github.com/InsanusMokrassar/MicroUtils.git
synced 2025-09-09 02:00:01 +00:00
update dependnecies
This commit is contained in:
@@ -2,19 +2,19 @@ package dev.inmo.micro_utils.pagination
|
||||
|
||||
import org.jetbrains.exposed.sql.*
|
||||
|
||||
fun Query.paginate(with: Pagination, orderBy: Pair<Expression<*>, SortOrder>? = null) = limit(
|
||||
with.size,
|
||||
with.firstIndex.toLong()
|
||||
).let {
|
||||
if (orderBy != null) {
|
||||
it.orderBy(
|
||||
orderBy.first,
|
||||
orderBy.second
|
||||
)
|
||||
} else {
|
||||
it
|
||||
fun Query.paginate(with: Pagination, orderBy: Pair<Expression<*>, SortOrder>? = null) =
|
||||
limit(with.size)
|
||||
.offset(with.firstIndex.toLong())
|
||||
.let {
|
||||
if (orderBy != null) {
|
||||
it.orderBy(
|
||||
orderBy.first,
|
||||
orderBy.second
|
||||
)
|
||||
} else {
|
||||
it
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun Query.paginate(with: Pagination, orderBy: Expression<*>?, reversed: Boolean = false) = paginate(
|
||||
with,
|
||||
|
Reference in New Issue
Block a user