Skip to content

Commit 956411e

Browse files
committed
[Kotlin] Better name for where
1 parent 75fe771 commit 956411e

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ abstract class KotlinBaseBuilder<D : AbstractWhereSupport<*,*>> {
6969
getDsl().where().or(criteria)
7070
}
7171

72-
@Deprecated("Please use independentWhere to create a standalone where clause, then pass it to the where method")
72+
@Deprecated("Please create an independent where clause, then pass it to the \"where\" method")
7373
fun applyWhere(whereApplier: WhereApplier) = whereApplier.invoke(this)
7474

7575
/**

src/main/kotlin/org/mybatis/dynamic/sql/util/kotlin/elements/SqlElements.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,21 +77,21 @@ import org.mybatis.dynamic.sql.where.condition.IsNotNull
7777
import org.mybatis.dynamic.sql.where.condition.IsNull
7878

7979
/**
80-
* No-Op function for code beautification. This allows creation of an independent where clause
80+
* Simple function for code beautification. This allows creation of an independent where clause
8181
* that can be reused in different statements. For example:
8282
*
83-
* val independentWhereClause = independentWhere { id isEqualTo 3 }
83+
* val whereClause = where { id isEqualTo 3 }
8484
*
8585
* val rows = countFrom(foo) {
86-
* where(independentWhereClause)
86+
* where(whereClause)
8787
* }
8888
*
8989
* Use of this function is optional. You can also write code like this:
9090
*
91-
* val independentWhereClause: GroupingCriteriaReceiver = { id isEqualTo 3 }
91+
* val whereClause: GroupingCriteriaReceiver = { id isEqualTo 3 }
9292
*
9393
*/
94-
fun independentWhere(receiver: GroupingCriteriaReceiver): GroupingCriteriaReceiver = receiver
94+
fun where(receiver: GroupingCriteriaReceiver): GroupingCriteriaReceiver = receiver
9595

9696
// support for criteria without initial conditions
9797
fun and(receiver: GroupingCriteriaReceiver): AndOrCriteriaGroup =

src/test/kotlin/examples/kotlin/mybatis3/canonical/ReusableWhereTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import org.junit.jupiter.api.Test
2828
import org.junit.jupiter.api.TestInstance
2929
import org.mybatis.dynamic.sql.util.kotlin.WhereApplier
3030
import org.mybatis.dynamic.sql.util.kotlin.andThen
31-
import org.mybatis.dynamic.sql.util.kotlin.elements.independentWhere
31+
import org.mybatis.dynamic.sql.util.kotlin.elements.where
3232
import org.mybatis.dynamic.sql.util.kotlin.mybatis3.select
3333

3434
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
@@ -145,7 +145,7 @@ class ReusableWhereTest {
145145
or { occupation.isNull() }
146146
}
147147

148-
private val commonWhereClause = independentWhere {
148+
private val commonWhereClause = where {
149149
id isEqualTo 1
150150
or { occupation.isNull() }
151151
}

0 commit comments

Comments
 (0)