#172 - Upgrade to Coroutines 1.3.0.

Original pull request: #173.
This commit is contained in:
Sebastien Deleuze
2019-09-04 10:55:12 +02:00
committed by Mark Paluch
parent 70f05785d8
commit 9064b04110
2 changed files with 6 additions and 9 deletions

View File

@@ -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()

View File

@@ -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>>()