From e9d94e6407c4aac75987e0f4a3e78e4385029de8 Mon Sep 17 00:00:00 2001 From: allbegray Date: Sat, 4 Mar 2023 05:44:56 +0900 Subject: [PATCH] :art: clean code --- src/main/kotlin/herbaccara/jooq/Pagination.kt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/herbaccara/jooq/Pagination.kt b/src/main/kotlin/herbaccara/jooq/Pagination.kt index c32d0c2..b687d56 100644 --- a/src/main/kotlin/herbaccara/jooq/Pagination.kt +++ b/src/main/kotlin/herbaccara/jooq/Pagination.kt @@ -18,12 +18,16 @@ class Pagination { @JvmStatic fun sortFields(sort: Sort, dialect: SQLDialect): List> { - if (sort.isEmpty) return emptyList() - val quote = when (dialect) { MYSQL, MARIADB, H2 -> "`" else -> "\"" } + return sortFields(sort, quote) + } + + @JvmStatic + fun sortFields(sort: Sort, quote: String): List> { + if (sort.isEmpty) return emptyList() return sort.map { s -> val field = DSL.field("${quote}${s.property}$quote")