public interface Result
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.
Modifier and Type | Interface and Description |
---|---|
static interface |
Result.Message
Message segment reported as result of the statement processing.
|
static interface |
Result.OutSegment
Out parameters segment consisting of
readable data . |
static interface |
Result.RowSegment
Row segment consisting of
row data . |
static interface |
Result.Segment
Marker interface for a result segment.
|
static interface |
Result.UpdateCount
Update count segment consisting providing a
affected rows count . |
Modifier and Type | Method and Description |
---|---|
Result |
filter(Predicate<Result.Segment> filter)
Returns a filtered variant of the
Result to selectively consume result segments matching filter predicate . |
<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. |
Publisher<Integer> |
getRowsUpdated()
Returns the number of rows updated by a query against a database.
|
<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.
|
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.
|
Publisher<Integer> getRowsUpdated()
Consuming the update count may emit an error signal
if the results contain one or more error message segments
.
IllegalStateException
- if the result was consumed<T> Publisher<T> map(BiFunction<Row,RowMetadata,? extends T> mappingFunction)
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
.
T
- the type of the mapped valuemappingFunction
- the BiFunction
that maps a Row
and RowMetadata
to a valueIllegalArgumentException
- if mappingFunction
is null
IllegalStateException
- if the result was consumeddefault <T> Publisher<T> map(Function<? super Readable,? extends T> mappingFunction)
Readable
can be only
considered valid within a mapping function
callback.T
- the type of the mapped valuemappingFunction
- the Function
that maps a Readable
to a valueIllegalArgumentException
- if mappingFunction
is null
IllegalStateException
- if the result was consumedRow
,
OutParameters
Result filter(Predicate<Result.Segment> filter)
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 Result.Message
segments
from the result
lets the result complete without an error.
filter
- the non-interfering and stateless Predicate
to apply to each element to determine if it should be includedResult
IllegalArgumentException
- if filter
is null
IllegalStateException
- if the result was consumed<T> Publisher<T> flatMap(Function<Result.Segment,? extends Publisher<? extends T>> mappingFunction)
result segments
that are the results of a query against a database. May be empty if the query did not return any segments. A Result.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.
T
- the type of the mapped valuemappingFunction
- the Function
that maps a Result.Segment
a to a Publisher
IllegalArgumentException
- if mappingFunction
is null
IllegalStateException
- if the result was consumedCopyright © 2021. All rights reserved.