From 69c8a18bd1a21181cf7ac5300b9b0854cc0fa89c Mon Sep 17 00:00:00 2001 From: usbharu <64310155+usbharu@users.noreply.github.com> Date: Mon, 29 Jan 2024 18:03:48 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20Kotlin/JVM=E3=81=AE=E5=88=B6?= =?UTF-8?q?=E9=99=90=E3=81=AE=E3=81=9F=E3=82=81=E3=81=AE=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../exposed/ExposedPaginationExtension.kt | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/src/main/kotlin/dev/usbharu/hideout/application/infrastructure/exposed/ExposedPaginationExtension.kt b/src/main/kotlin/dev/usbharu/hideout/application/infrastructure/exposed/ExposedPaginationExtension.kt index 796ab0c6..f00d9dcb 100644 --- a/src/main/kotlin/dev/usbharu/hideout/application/infrastructure/exposed/ExposedPaginationExtension.kt +++ b/src/main/kotlin/dev/usbharu/hideout/application/infrastructure/exposed/ExposedPaginationExtension.kt @@ -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): 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>): Query { +fun Query.pagination(page: Page, exp: ExpressionWithColumnType): Query { if (page.minId != null) { page.maxId?.let { andWhere { exp.less(it) } } page.minId?.let { andWhere { exp.greater(it) } }