Top Description Fields Constructors Methods
org.springframework.r2dbc.core

pack-priv Class DefaultFetchSpec<T>

extends Object
implements FetchSpec<T>
Class Inheritance
All Implemented Interfaces
org.springframework.r2dbc.core.FetchSpec, org.springframework.r2dbc.core.UpdatedRowsFetchSpec, org.springframework.r2dbc.core.RowsFetchSpec
Type Parameters
<T>
the row result type
Imports
java.util.function.Function, io.r2dbc.spi.Connection, .Result, org.reactivestreams.Publisher, reactor.core.publisher.Flux, .Mono, org.springframework.dao.IncorrectResultSizeDataAccessException

Default FetchSpec implementation.
Authors
Mark Paluch, Simon Baslé
Since
5.3

Field Summary

Modifier and TypeField and Description
private final ConnectionAccessor
private final Function<Result, Publisher<T>>
private final ResultFunction
private final Function<Connection, Mono<Long>>

Constructor Summary

AccessConstructor and Description
pack-priv
DefaultFetchSpec(ConnectionAccessor connectionAccessor, ResultFunction resultFunction, Function<Connection, Mono<Long>> updatedRowsFunction, Function<Result, Publisher<T>> resultAdapter)

Method Summary

Modifier and TypeMethod and Description
public Flux<T>
all()

Implements org.springframework.r2dbc.core.RowsFetchSpec.all.

Get all matching elements.
public Mono<T>
first()

Implements org.springframework.r2dbc.core.RowsFetchSpec.first.

Get the first or no result.
public Mono<T>
one()

Implements org.springframework.r2dbc.core.RowsFetchSpec.one.

Get exactly zero or one result.
public Mono<Long>
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

connectionAccessorback to summary
private final ConnectionAccessor connectionAccessor
resultAdapterback to summary
private final Function<Result, Publisher<T>> resultAdapter
resultFunctionback to summary
private final ResultFunction resultFunction
updatedRowsFunctionback to summary
private final Function<Connection, Mono<Long>> updatedRowsFunction

Constructor Detail

DefaultFetchSpecback to summary
pack-priv DefaultFetchSpec(ConnectionAccessor connectionAccessor, ResultFunction resultFunction, Function<Connection, Mono<Long>> updatedRowsFunction, Function<Result, Publisher<T>> resultAdapter)

Method Detail

allback to summary
public Flux<T> all()

Implements org.springframework.r2dbc.core.RowsFetchSpec.all.

Doc from org.springframework.r2dbc.core.RowsFetchSpec.all.

Get all matching elements.

Returns:Flux<T>

a Flux emitting all results

Annotations
@Override
firstback to summary
public Mono<T> first()

Implements org.springframework.r2dbc.core.RowsFetchSpec.first.

Doc from org.springframework.r2dbc.core.RowsFetchSpec.first.

Get the first or no result.

Returns:Mono<T>

a Mono emitting the first element, or Mono#empty() if no match found

Annotations
@Override
oneback to summary
public Mono<T> one()

Implements org.springframework.r2dbc.core.RowsFetchSpec.one.

Doc from org.springframework.r2dbc.core.RowsFetchSpec.one.

Get exactly zero or one result.

Returns:Mono<T>

a Mono emitting one element, or Mono#empty() if no match found. Completes with IncorrectResultSizeDataAccessException if more than one match found

Annotations
@Override
rowsUpdatedback to summary
public Mono<Long> rowsUpdated()

Implements org.springframework.r2dbc.core.UpdatedRowsFetchSpec.rowsUpdated.

Doc from org.springframework.r2dbc.core.UpdatedRowsFetchSpec.rowsUpdated.

Get the number of updated rows.

Returns:Mono<Long>

a Mono emitting the number of updated rows

Annotations
@Override