committed by
Mark Paluch
parent
70f05785d8
commit
9064b04110
@@ -15,10 +15,10 @@
|
||||
*/
|
||||
package org.springframework.data.r2dbc.core
|
||||
|
||||
import kotlinx.coroutines.FlowPreview
|
||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.reactive.asFlow
|
||||
import kotlinx.coroutines.reactive.awaitFirstOrNull
|
||||
import kotlinx.coroutines.reactive.flow.asFlow
|
||||
import org.springframework.dao.EmptyResultDataAccessException
|
||||
|
||||
/**
|
||||
@@ -58,10 +58,7 @@ suspend fun <T> RowsFetchSpec<T>.awaitFirstOrNull(): T? =
|
||||
/**
|
||||
* Coroutines [Flow] variant of [RowsFetchSpec.all].
|
||||
*
|
||||
* Backpressure is controlled by [batchSize] parameter that controls the size of in-flight elements
|
||||
* and [org.reactivestreams.Subscription.request] size.
|
||||
*
|
||||
* @author Sebastien Deleuze
|
||||
*/
|
||||
@FlowPreview
|
||||
fun <T : Any> RowsFetchSpec<T>.flow(batchSize: Int = 1): Flow<T> = all().asFlow(batchSize)
|
||||
@ExperimentalCoroutinesApi
|
||||
fun <T : Any> RowsFetchSpec<T>.flow(): Flow<T> = all().asFlow()
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.springframework.data.r2dbc.core
|
||||
import io.mockk.every
|
||||
import io.mockk.mockk
|
||||
import io.mockk.verify
|
||||
import kotlinx.coroutines.FlowPreview
|
||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||
import kotlinx.coroutines.flow.toList
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import org.assertj.core.api.Assertions.assertThat
|
||||
@@ -157,7 +157,7 @@ class RowsFetchSpecExtensionsTests {
|
||||
}
|
||||
|
||||
@Test // gh-91
|
||||
@FlowPreview
|
||||
@ExperimentalCoroutinesApi
|
||||
fun allAsFlow() {
|
||||
|
||||
val spec = mockk<RowsFetchSpec<String>>()
|
||||
|
||||
Reference in New Issue
Block a user