Skip to content

Commit

Permalink
🎨 clean code
Browse files Browse the repository at this point in the history
  • Loading branch information
allbegray committed Mar 3, 2023
1 parent f5f8f7b commit e9d94e6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/main/kotlin/herbaccara/jooq/Pagination.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,16 @@ class Pagination {

@JvmStatic
fun sortFields(sort: Sort, dialect: SQLDialect): List<SortField<Any>> {
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<SortField<Any>> {
if (sort.isEmpty) return emptyList()

return sort.map { s ->
val field = DSL.field("${quote}${s.property}$quote")
Expand Down

0 comments on commit e9d94e6

Please sign in to comment.