Skip to content

Commit

Permalink
Fix consistency of extensions
Browse files Browse the repository at this point in the history
Signed-off-by: George Papadopoulos <[email protected]>
  • Loading branch information
GeorgePap-719 committed Oct 10, 2022
1 parent 6bdc7db commit d4c3cc0
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ package org.springframework.data.r2dbc.core

import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.reactive.asFlow
import kotlinx.coroutines.reactive.awaitFirst
import kotlinx.coroutines.reactive.awaitFirstOrNull
import kotlinx.coroutines.reactive.awaitSingle
import kotlinx.coroutines.reactor.awaitSingleOrNull

/**
* Extensions for [ReactiveSelectOperation].
Expand Down Expand Up @@ -49,13 +51,13 @@ suspend inline fun <reified T : Any> ReactiveSelectOperation.TerminatingSelect<T
* Nullable Coroutines variant of [ReactiveSelectOperation.TerminatingSelect.one].
*/
suspend inline fun <reified T : Any> ReactiveSelectOperation.TerminatingSelect<T>.awaitOneOrNull(): T? =
one().awaitFirstOrNull()
one().awaitSingleOrNull()

/**
* Non-nullable Coroutines variant of [ReactiveSelectOperation.TerminatingSelect.first].
*/
suspend inline fun <reified T : Any> ReactiveSelectOperation.TerminatingSelect<T>.awaitFirst(): T =
first().awaitSingle()
first().awaitFirst()

/**
* Nullable Coroutines variant of [ReactiveSelectOperation.TerminatingSelect.first].
Expand Down

0 comments on commit d4c3cc0

Please sign in to comment.