Package org.springframework.r2dbc.core
Interface DatabaseClient
- All Superinterfaces:
- ConnectionAccessor
A non-blocking, reactive client for performing database calls with
 Reactive Streams back pressure. Provides a higher level, common API over
 R2DBC client libraries.
 
Use the static factory method create(ConnectionFactory) or obtain
 a builder to create an instance.
 
Usage example:
 ConnectionFactory factory = …
 DatabaseClient client = DatabaseClient.create(factory);
 Mono<Actor> actor = client.sql("select first_name, last_name from t_actor")
     .map(row -> new Actor(row.get("first_name", String.class),
          row.get("last_name", String.class)))
     .first();- Since:
- 5.3
- Author:
- Mark Paluch
- 
Nested Class SummaryNested ClassesModifier and TypeInterfaceDescriptionstatic interfaceA mutable builder for creating aDatabaseClient.static interfaceContract for specifying an SQL call along with options leading to the execution.
- 
Method SummaryModifier and TypeMethodDescriptionstatic DatabaseClient.Builderbuilder()Obtain aDatabaseClientbuilder.static DatabaseClientcreate(ConnectionFactory factory) Create aDatabaseClientthat will use the providedConnectionFactory.Get theConnectionFactorythat this client uses.Specify a staticsqlstatement to run.Specify an SQL supplier that provides SQL to run.Methods inherited from interface org.springframework.r2dbc.core.ConnectionAccessorinConnection, inConnectionMany
- 
Method Details- 
getConnectionFactoryConnectionFactory getConnectionFactory()Get theConnectionFactorythat this client uses.- Returns:
- the connection factory
 
- 
sqlSpecify a staticsqlstatement to run. Contract for specifying an SQL call along with options leading to the execution. The SQL string can contain either native parameter bind markers or named parameters (e.g. :foo, :bar) whenNamedParameterExpanderis enabled.- Parameters:
- sql- the SQL statement
- Returns:
- a new DatabaseClient.GenericExecuteSpec
- See Also:
- 
- NamedParameterExpander
- DatabaseClient.Builder.namedParameters(boolean)
 
 
- 
sqlSpecify an SQL supplier that provides SQL to run. Contract for specifying an SQL call along with options leading to the execution. The SQL string can contain either native parameter bind markers or named parameters (e.g. :foo, :bar) whenNamedParameterExpanderis enabled.Accepts PreparedOperationas SQL and bindingSupplier.DatabaseClientimplementations should defer the resolution of the SQL string as much as possible, ideally up to the point where aSubscriptionhappens. This is the case for the default implementation.- Parameters:
- sqlSupplier- a supplier for the SQL statement
- Returns:
- a new DatabaseClient.GenericExecuteSpec
- See Also:
- 
- NamedParameterExpander
- DatabaseClient.Builder.namedParameters(boolean)
- PreparedOperation
 
 
- 
createCreate aDatabaseClientthat will use the providedConnectionFactory.- Parameters:
- factory- the- ConnectionFactoryto use for obtaining connections
- Returns:
- a new DatabaseClient; nevernull
 
- 
builderObtain aDatabaseClientbuilder.
 
-