Skip to content

Commit 67f2574

Browse files
committed
Necessary high level API refactor after big refactor about base-query
1 parent 3d2ee9c commit 67f2574

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

project/jimmer-sql-kotlin/src/main/kotlin/org/babyfish/jimmer/sql/kt/KSqlClient.kt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ interface KSqlClient : KDeprecatedMoreSaveOperations {
7575
entityType: KClass<E>,
7676
limit: Int? = null,
7777
con: Connection? = null,
78-
block: KMutableRootQuery<KNonNullTable<E>>.() -> KConfigurableRootQuery<KNonNullTable<E>, R>
78+
block: KMutableRootQuery.ForEntity<E>.() -> KConfigurableRootQuery<KNonNullTable<E>, R>
7979
): List<R> = queries
8080
.forEntity(entityType, block)
8181
.let { q ->
@@ -184,7 +184,7 @@ interface KSqlClient : KDeprecatedMoreSaveOperations {
184184
fetcher: Fetcher<E>,
185185
limit: Int? = null,
186186
con: Connection? = null,
187-
block: KMutableRootQuery<KNonNullTable<E>>.() -> Unit = {}
187+
block: KMutableRootQuery.ForEntity<E>.() -> Unit = {}
188188
): List<E> = executeQuery(fetcher.javaClass.kotlin, limit, con) {
189189
block()
190190
select(table.fetch(fetcher))
@@ -193,7 +193,7 @@ interface KSqlClient : KDeprecatedMoreSaveOperations {
193193
fun <E : Any> findOne(
194194
fetcher: Fetcher<E>,
195195
con: Connection? = null,
196-
block: KMutableRootQuery<KNonNullTable<E>>.() -> Unit
196+
block: KMutableRootQuery.ForEntity<E>.() -> Unit
197197
): E = findAll(fetcher, 2, null, block).let {
198198
when (it.size) {
199199
0 -> throw EmptyResultException()
@@ -205,7 +205,7 @@ interface KSqlClient : KDeprecatedMoreSaveOperations {
205205
fun <E : Any> findOneOrNull(
206206
fetcher: Fetcher<E>,
207207
con: Connection? = null,
208-
block: KMutableRootQuery<KNonNullTable<E>>.() -> Unit
208+
block: KMutableRootQuery.ForEntity<E>.() -> Unit
209209
): E? = findAll(fetcher, 2, con, block).let {
210210
when (it.size) {
211211
0 -> null
@@ -218,7 +218,7 @@ interface KSqlClient : KDeprecatedMoreSaveOperations {
218218
viewType: KClass<V>,
219219
limit: Int? = null,
220220
con: Connection? = null,
221-
block: KMutableRootQuery<KNonNullTable<E>>.() -> Unit = {}
221+
block: KMutableRootQuery.ForEntity<E>.() -> Unit = {}
222222
): List<V> {
223223
val metadata = DtoMetadata.of(viewType.java)
224224
return findAll(metadata.fetcher, limit, con, block).map(metadata.converter::apply)
@@ -227,7 +227,7 @@ interface KSqlClient : KDeprecatedMoreSaveOperations {
227227
fun <E : Any, V : View<E>> findOne(
228228
viewType: KClass<V>,
229229
con: Connection? = null,
230-
block: KMutableRootQuery<KNonNullTable<E>>.() -> Unit
230+
block: KMutableRootQuery.ForEntity<E>.() -> Unit
231231
): V {
232232
val metadata = DtoMetadata.of(viewType.java)
233233
return findOne(metadata.fetcher, con, block).let(metadata.converter::apply)
@@ -236,7 +236,7 @@ interface KSqlClient : KDeprecatedMoreSaveOperations {
236236
fun <E : Any, V : View<E>> findOneOrNull(
237237
viewType: KClass<V>,
238238
con: Connection? = null,
239-
block: KMutableRootQuery<KNonNullTable<E>>.() -> Unit
239+
block: KMutableRootQuery.ForEntity<E>.() -> Unit
240240
): V? {
241241
val metadata = DtoMetadata.of(viewType.java)
242242
return findOneOrNull(metadata.fetcher, con, block)?.let(metadata.converter::apply)

project/jimmer-sql-kotlin/src/main/kotlin/org/babyfish/jimmer/sql/kt/KSqlClientExtensions.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import kotlin.reflect.KProperty1
99

1010
fun <E : Any> KSqlClient.exists(
1111
type: KClass<E>,
12-
block: KMutableRootQuery<KNonNullTable<E>>.() -> Unit = {}
12+
block: KMutableRootQuery.ForEntity<E>.() -> Unit = {}
1313
): Boolean = queries.forEntity(type) {
1414
block()
1515
select(constant(1))

0 commit comments

Comments
 (0)