mirror of https://github.com/usbharu/Hideout.git
refactor: Kotlin/JVMの制限のための変更
This commit is contained in:
parent
deb2d5b0b5
commit
69c8a18bd1
|
@ -1,25 +1,11 @@
|
|||
package dev.usbharu.hideout.application.infrastructure.exposed
|
||||
|
||||
import org.jetbrains.exposed.dao.id.EntityID
|
||||
import org.jetbrains.exposed.sql.ExpressionWithColumnType
|
||||
import org.jetbrains.exposed.sql.Query
|
||||
import org.jetbrains.exposed.sql.SortOrder
|
||||
import org.jetbrains.exposed.sql.andWhere
|
||||
|
||||
fun Query.pagination(page: Page, exp: ExpressionWithColumnType<Long>): Query {
|
||||
if (page.minId != null) {
|
||||
page.maxId?.let { andWhere { exp.less(it) } }
|
||||
page.minId?.let { andWhere { exp.greater(it) } }
|
||||
} else {
|
||||
page.maxId?.let { andWhere { exp.less(it) } }
|
||||
page.sinceId?.let { andWhere { exp.greater(it) } }
|
||||
this.orderBy(exp, SortOrder.DESC)
|
||||
}
|
||||
page.limit?.let { limit(it) }
|
||||
return this
|
||||
}
|
||||
|
||||
fun Query.pagination(page: Page, exp: ExpressionWithColumnType<EntityID<Long>>): Query {
|
||||
fun <S> Query.pagination(page: Page, exp: ExpressionWithColumnType<S>): Query {
|
||||
if (page.minId != null) {
|
||||
page.maxId?.let { andWhere { exp.less(it) } }
|
||||
page.minId?.let { andWhere { exp.greater(it) } }
|
||||
|
|
Loading…
Reference in New Issue