Top Description Inners Methods
io.r2dbc.spi

public Interface Result

Imports
org.reactivestreams.Publisher, .Subscriber, java.util.function.BiFunction, .Function, .Predicate

Represents the results of a query against a database. Results can be consumed only once by either consuming getRowsUpdated(), map(BiFunction), or map(Function).

A Result object maintains a consumption state that may be backed by a cursor pointing to its current row of data or out parameters. A Result allows read-only and forward-only consumption of statement results. Thus, you can consume either getRowsUpdated(), Rows, or Rows or out parameters through it only once and only from the first to the last row/parameter set.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
Result.Message

Message segment reported as result of the statement processing.

public static interface
Result.OutSegment

Out parameters segment consisting of readable data.

public static interface
Result.RowSegment

Row segment consisting of row data.

public static interface
Result.Segment

Marker interface for a result segment.

public static interface
Result.UpdateCount

Update count segment consisting providing a affected rows count.

Method Summary

Modifier and TypeMethod and Description
public Result

Returns:

a filtered Result
filter
(Predicate<Result.Segment>
the non-interfering and stateless Predicate to apply to each element to determine if it should be included
filter
)

Returns a filtered variant of the Result to selectively consume result segments matching filter predicate.

public <
the type of the mapped value
T
>
Publisher<T>

Returns:

a mapping of the segments that are the results of a query against a database
flatMap
(Function<Result.Segment, ? extends Publisher<? extends T>>
the Function that maps a Segment a to a Publisher
mappingFunction
)

Returns a mapping of the result segments that are the results of a query against a database.

public Publisher<Long>

Returns:

the number of rows updated by a query against a database
getRowsUpdated
()

Returns the number of rows updated by a query against a database.

public <
the type of the mapped value
T
>
Publisher<T>

Returns:

a mapping of the rows that are the results of a query against a database
map
(BiFunction<Row, RowMetadata, ? extends T>
the BiFunction that maps a Row and RowMetadata to a value
mappingFunction
)

Returns a mapping of the rows that are the results of a query against a database.

public default <
the type of the mapped value
T
>
Publisher<T>

Returns:

a mapping of the rows that are the results of a query against a database
map
(Function<? super Readable, ? extends T>
the Function that maps a Readable to a value
mappingFunction
)

Returns a mapping of the rows/out parameters that are the results of a query against a database.

Method Detail

filterback to summary
public Result filter(Predicate<Result.Segment> filter)

Returns a filtered variant of the Result to selectively consume result segments matching filter predicate.

The returned Result is a potentially reduced view of the underlying Result to filter out unwanted result segments. For example, filtering all Message segments from the result lets the result complete without an error.

Parameters
filter:Predicate<Result.Segment>

the non-interfering and stateless Predicate to apply to each element to determine if it should be included

Returns:Result

a filtered Result

Exceptions
IllegalArgumentException:
if filter is null
IllegalStateException:
if the result was consumed
Since
0.9
flatMapback to summary
public <T> Publisher<T> flatMap(Function<Result.Segment, ? extends Publisher<? extends T>> mappingFunction)

Returns a mapping of the result segments that are the results of a query against a database. May be empty if the query did not return any segments. A Segment can be only considered valid within a mapping function callback.

Consuming result segments does not emit error signals from message segments representing an error. Translation of error segments is subject to the mappingFunction.

Signals from mapped publishers are replayed sequentially preserving ordering by concatenating publishers.

Parameters
<T>
the type of the mapped value
mappingFunction:Function<Result.Segment, ? extends Publisher<? extends T>>

the Function that maps a Segment a to a Publisher

Returns:Publisher<T>

a mapping of the segments that are the results of a query against a database

Exceptions
IllegalArgumentException:
if mappingFunction is null
IllegalStateException:
if the result was consumed
Since
0.9
getRowsUpdatedback to summary
public Publisher<Long> getRowsUpdated()

Returns the number of rows updated by a query against a database. May be empty if the query did not update any rows.

Consuming the update count may emit an error signal if the results contain one or more error message segments.

Returns:Publisher<Long>

the number of rows updated by a query against a database

Exceptions
IllegalStateException:
if the result was consumed
mapback to summary
public <T> Publisher<T> map(BiFunction<Row, RowMetadata, ? extends T> mappingFunction)

Returns a mapping of the rows that are the results of a query against a database. May be empty if the query did not return any rows. A Row can be only considered valid within a mapping function callback.

Consuming data rows may emit an error signal if the results contain one or more error message segments.

Parameters
<T>
the type of the mapped value
mappingFunction:BiFunction<Row, RowMetadata, ? extends T>

the BiFunction that maps a Row and RowMetadata to a value

Returns:Publisher<T>

a mapping of the rows that are the results of a query against a database

Exceptions
IllegalArgumentException:
if mappingFunction is null
IllegalStateException:
if the result was consumed
mapback to summary
public default <T> Publisher<T> map(Function<? super Readable, ? extends T> mappingFunction)

Returns a mapping of the rows/out parameters that are the results of a query against a database. May be empty if the query did not return any results. A Readable can be only considered valid within a mapping function callback.

Parameters
<T>
the type of the mapped value
mappingFunction:Function<? super Readable, ? extends T>

the Function that maps a Readable to a value

Returns:Publisher<T>

a mapping of the rows that are the results of a query against a database

Exceptions
IllegalArgumentException:
if mappingFunction is null
IllegalStateException:
if the result was consumed
Since
0.9
See Also
Row, OutParameters
io.r2dbc.spi back to summary

public Interface Result.Message

extends Segment

Message segment reported as result of the statement processing.
Since
0.9

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

the vendor-specific error code
errorCode
()

Returns the vendor-specific error code.

public R2dbcException

Returns:

the error as R2dbcException.
exception
()

Return the error as R2dbcException.

public String

Returns:

the message text. MockResult.java
message
()

Returns the message text.

public String

Returns:

the SQLState
sqlState
()

Returns the SQLState.

Method Detail

errorCodeback to summary
public int errorCode()

Returns the vendor-specific error code.

Returns:int

the vendor-specific error code

exceptionback to summary
public R2dbcException exception()

Return the error as R2dbcException.

Returns:R2dbcException

the error as R2dbcException.

messageback to summary
public String message()

Returns the message text.

Returns:String

the message text. MockResult.java

sqlStateback to summary
public String sqlState()

Returns the SQLState.

Returns:String

the SQLState

Annotations
@Nullable
io.r2dbc.spi back to summary

public Interface Result.OutSegment

extends Segment

Out parameters segment consisting of readable data.
Since
0.9

Method Summary

Modifier and TypeMethod and Description
public OutParameters

Method Detail

outParametersback to summary
public OutParameters outParameters()
io.r2dbc.spi back to summary

public Interface Result.RowSegment

extends Segment

Row segment consisting of row data.
Since
0.9

Method Summary

Modifier and TypeMethod and Description
public Row
row()

Method Detail

rowback to summary
public Row row()
io.r2dbc.spi back to summary

public Interface Result.Segment

Known Direct Subinterfaces
io.r2dbc.spi.Result.RowSegment, io.r2dbc.spi.Result.OutSegment, io.r2dbc.spi.Result.UpdateCount, io.r2dbc.spi.Result.Message

Marker interface for a result segment. Result segments represent the individual parts of a result from a query against a database. Segments are typically update counts, data rows/OUT parameters, and messages of varying severities. Segments can also represent vendor-specific extensions.
Since
0.9
io.r2dbc.spi back to summary

public Interface Result.UpdateCount

extends Segment

Update count segment consisting providing a affected rows count.
Since
0.9

Method Summary

Modifier and TypeMethod and Description
public long

Method Detail

valueback to summary
public long value()