Upgrade to Coroutines 1.4.0-M1 and use awaitSingle()

This commit raises the minimum Coroutines version supported
to 1.4.0-M1 and above, and changes usages of awaitFirst() or
awaitFirstOrNull() to awaitSingle() or awaitSingleOrNull()
to fix gh-25007.

Closes gh-25914
Closes gh-25007
This commit is contained in:
Sébastien Deleuze
2020-10-13 15:23:38 +02:00
parent cd835b3124
commit 3ed8813bbf
14 changed files with 38 additions and 38 deletions

View File

@@ -6749,7 +6749,7 @@ The following query gets the `id` and `name` columns from a table:
.Kotlin
----
val first = client.sql("SELECT id, name FROM person")
.fetch().awaitFirst()
.fetch().awaitSingle()
----
The following query uses a bind variable:
@@ -6766,7 +6766,7 @@ The following query uses a bind variable:
----
val first = client.sql("SELECT id, name FROM person WHERE WHERE first_name = :fn")
.bind("fn", "Joe")
.fetch().awaitFirst()
.fetch().awaitSingle()
----
You might have noticed the use of `fetch()` in the example above. `fetch()` is a
@@ -6776,7 +6776,7 @@ Calling `first()` returns the first row from the result and discards remaining r
You can consume data with the following operators:
* `first()` return the first row of the entire result. Its Kotlin Coroutine variant
is named `awaitFirst()` for non-nullable return values and `awaitFirstOrNull()`
is named `awaitSingle()` for non-nullable return values and `awaitSingleOrNull()`
if the value is optional.
* `one()` returns exactly one result and fails if the result contains more rows.
Using Kotlin Coroutines, `awaitOne()` for exactly one value or `awaitOneOrNull()`

View File

@@ -434,7 +434,7 @@ dependencies {
}
----
Version `1.3.9` and above are supported.
Version `1.4.0-M1` and above are supported.
=== How Reactive translates to Coroutines?

View File

@@ -601,7 +601,7 @@ Then start an RSocket server through the Java RSocket API and plug the
val server = RSocketServer.create(handler.responder())
.bind(TcpServerTransport.create("localhost", 7000))
.awaitFirst()
.awaitSingle()
----
`RSocketMessageHandler` supports

View File

@@ -172,7 +172,7 @@ Flux<Person> people = request.body(BodyExtractors.toFlux(Person.class));
[source,kotlin,role="secondary"]
.Kotlin
----
val string = request.body(BodyExtractors.toMono(String::class.java)).awaitFirst()
val string = request.body(BodyExtractors.toMono(String::class.java)).awaitSingle()
val people = request.body(BodyExtractors.toFlux(Person::class.java)).asFlow()
----