Skip to content

Commit d126d33

Browse files
committed
Select DSL functions are Unit functions
1 parent 5249d82 commit d126d33

File tree

2 files changed

+30
-42
lines changed

2 files changed

+30
-42
lines changed

src/main/kotlin/org/mybatis/dynamic/sql/util/kotlin/KotlinBaseBuilders.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ abstract class KotlinBaseBuilder<D : AbstractWhereSupport<*>> {
147147

148148
fun allRows() {}
149149

150-
private fun applyToWhere(block: AbstractWhereDSL<*>.() -> Unit): Unit {
150+
private fun applyToWhere(block: AbstractWhereDSL<*>.() -> Unit) {
151151
getDsl().where().apply(block)
152152
}
153153

src/main/kotlin/org/mybatis/dynamic/sql/util/kotlin/KotlinSelectBuilder.kt

+29-41
Original file line numberDiff line numberDiff line change
@@ -30,56 +30,44 @@ class KotlinSelectBuilder(private val fromGatherer: QueryExpressionDSL.FromGathe
3030

3131
private lateinit var dsl: QueryExpressionDSL<SelectModel>
3232

33-
fun from(table: SqlTable): KotlinSelectBuilder =
34-
apply {
35-
dsl = fromGatherer.from(table)
36-
}
33+
fun from(table: SqlTable) {
34+
dsl = fromGatherer.from(table)
35+
}
3736

38-
fun from(table: SqlTable, alias: String): KotlinSelectBuilder =
39-
apply {
40-
dsl = fromGatherer.from(table, alias)
41-
}
37+
fun from(table: SqlTable, alias: String) {
38+
dsl = fromGatherer.from(table, alias)
39+
}
4240

43-
fun from(subQuery: KotlinQualifiedSubQueryBuilder.() -> Unit): KotlinSelectBuilder =
44-
apply {
45-
val builder = KotlinQualifiedSubQueryBuilder().apply(subQuery)
46-
dsl = fromGatherer.from(builder, builder.correlationName)
47-
}
41+
fun from(subQuery: KotlinQualifiedSubQueryBuilder.() -> Unit) {
42+
val builder = KotlinQualifiedSubQueryBuilder().apply(subQuery)
43+
dsl = fromGatherer.from(builder, builder.correlationName)
44+
}
4845

49-
fun groupBy(vararg columns: BasicColumn): KotlinSelectBuilder =
50-
apply {
51-
getDsl().groupBy(columns.toList())
52-
}
46+
fun groupBy(vararg columns: BasicColumn) {
47+
getDsl().groupBy(columns.toList())
48+
}
5349

54-
fun orderBy(vararg columns: SortSpecification): KotlinSelectBuilder =
55-
apply {
56-
getDsl().orderBy(columns.toList())
57-
}
50+
fun orderBy(vararg columns: SortSpecification) {
51+
getDsl().orderBy(columns.toList())
52+
}
5853

59-
fun limit(limit: Long): KotlinSelectBuilder =
60-
apply {
61-
getDsl().limit(limit)
62-
}
54+
fun limit(limit: Long) {
55+
getDsl().limit(limit)
56+
}
6357

64-
fun offset(offset: Long): KotlinSelectBuilder =
65-
apply {
66-
getDsl().offset(offset)
67-
}
58+
fun offset(offset: Long) {
59+
getDsl().offset(offset)
60+
}
6861

69-
fun fetchFirst(fetchFirstRows: Long): KotlinSelectBuilder =
70-
apply {
71-
getDsl().fetchFirst(fetchFirstRows).rowsOnly()
72-
}
62+
fun fetchFirst(fetchFirstRows: Long) {
63+
getDsl().fetchFirst(fetchFirstRows).rowsOnly()
64+
}
7365

74-
fun union(union: KotlinUnionBuilder.() -> Unit): KotlinSelectBuilder =
75-
apply {
76-
union(KotlinUnionBuilder(getDsl().union()))
77-
}
66+
fun union(union: KotlinUnionBuilder.() -> Unit): Unit =
67+
union(KotlinUnionBuilder(getDsl().union()))
7868

79-
fun unionAll(unionAll: KotlinUnionBuilder.() -> Unit): KotlinSelectBuilder =
80-
apply {
81-
unionAll(KotlinUnionBuilder(getDsl().unionAll()))
82-
}
69+
fun unionAll(unionAll: KotlinUnionBuilder.() -> Unit): Unit =
70+
unionAll(KotlinUnionBuilder(getDsl().unionAll()))
8371

8472
override fun build(): SelectModel = getDsl().build()
8573

0 commit comments

Comments
 (0)