MappingR2dbcConverter now considers custom conversions for inbound and outbound conversion of top-level types (Row to Entity, Entity to OutboundRow) and on property level (e.g. convert an object to String and vice versa).
Original pull request: #70.
All conversion functionality is now pulled together into MappingR2dbcConverter.
Introduce OutboundRow to provide mapping between column names and settable values. Remove identifier from SettableValue.
Original pull request: #62.
This commit introduces Coroutines support for `DatabaseClient`
functional API via Kotlin extensions that provide suspendable
functions prefixed by `await` for `Mono` based APIs.
Extensions for `Flux` will be added when Kotlin/kotlinx.coroutines#254
will be fixed.
It also provides `asType<Foo>()` extensions useful for Reactive API
as well.
Original pull request: #63.
Formatting.
Made Tests simpler and stricter by using `containsExactly`.
Added @Test annotation to ignored database specific tests so they actually show up as ignored.
Original pull request: #47.
DatabaseClient now supports named parameters prefixed with a colon such as :name in addition to database-native bind markers. Named parameters thus are supported in annotated repository query methods which also increases portability of queries across database vendors.
Named parameter support unrolls collection arguments to reduce the need for argument-specific SQL statements:
db.execute()
.sql("SELECT id, name, state FROM table WHERE age IN (:ages)")
.bind("ages", Arrays.asList(35, 50));
Results in a query: SELECT id, name, state FROM table WHERE age IN (35, 50)
Collection arguments containing nested object arrays can be used to use select lists:
List<Object[]> tuples = new ArrayList<>();
tuples.add(new Object[] {"John", 35});
tuples.add(new Object[] {"Ann", 50});
db.execute()
.sql("SELECT id, name, state FROM table WHERE (name, age) IN (:tuples)")
.bind("tuples", tuples);
translates to: SELECT id, name, state FROM table WHERE (name, age) IN (('John', 35), ('Ann', 50))
Original pull request: #47.
Postgres integration tests now run either with a locally installed and started database or if no such database can be found an instance gets started in a Docker container via Testcontainers.
We prefer a database based on TestContainers. Only if this can't be obtained do we try to access a local database for Postgres.
This minimizes the risk of accessing a database during tests that is not intended for that purpose.
If the system property `spring.data.r2dbc.test.preferLocalDatabase` is set to "true" the local database is preferred.
Original pull request: #51.
We now make sure to close connections only once by tracking the cleanup state. Flux.usingWhen/Mono.usingWhen do not ensure atomic cleanup in situations where the subscription completes and then the subscription is terminated.
This behavior has lead to closing a connection multiple times.
Related ticket: reactor/reactor-core#1486
Introduce ArrayColumns type to encapsulate Dialect-specific array support.
Apply array conversion for properties that do not match the native array type.
Add integration tests for Postgres array columns.
Original pull request: #31.
We now support custom conversions via R2dbcCustomConversions.
Custom conversions introduces simple types that depend on the used dialect.
Custom conversions and simple types are held in RelationalConverter and MappingContext.
Simple types and conversions are used by DatabaseClient and repository support to properly apply registered converters and support native types such as array-columns.
Related tickets: #22, #26.
Original pull request: #31.
Move retrieval methods from FetchSpec into RowsFetchSpec and UpdatedRowsFetchSpec.
map(…) now returns RowsFetchSpec to not expose updated rows count as mapped results are consumed as objects.
Original pull request: #33.
DatabaseClient now no longer exposes the exchange() method but rather provides map(…) and then(…) methods.
Calling map(…) extracts values from tabular results by propagating the mapping function to Result.map(…).
then() allows statement execution without returning the result propagating only completion and error signals.
Original pull request: #33.
Rename Database.latestDialect() to defaultDialect(). Rename Dialect.returnGeneratedKeys() to Dialect.generatedKeysClause(). Simplify IndexBindMarkers. Create BindableOperation.bind(Statement, SettableValue) to reduce code duplicates. Rename BindSpecWrapper to BindSpecAdapter.
Original pull request: #24.
We now provide dialect support for H2, PostgreSQL, and Microsoft SQL Server databases, configurable through AbstractR2dbcConfiguration. By default, we obtain the Dialect by inspecting ConnectionFactoryMetadata to identify the database and the most likely dialect to use.
BindableOperation encapsulates statements/queries that can accept parameters. Use BindableOperation for statements through DatabaseClient.
Extract SQL creation.
Split integration test into abstract base class that can be implemented with a database-specific test class.
Original pull request: #24.
We now provide an annotation-based activation model for R2DBC repositories. Configuration classes can be annotated with @EnableR2dbcRepositories and configuration infrastructure will scan for bean definitions to implement declared R2DBC repositories.
Original pull request: #17.
Improve Javadoc. Rename parameters for more expressiveness. Replace ASCII filtering with filter Function to move actual filtering into dialects.
Original pull request: #19.
We now expose a bind marker API that allows to model a vendor-specific bind marker strategy. The currently supported database systems (Postgres, MsSql) implement indexed respective named strategies that differ in how placeholders and identifiers are generated.
Original pull request: #19.
Introduce customization hook methods. Rename DefaultTypedGenericExecuteSpec to DefaultTypedExecuteSpec and GenericExecuteSpecSupport to ExecuteSpecSupport as types are not tied to generic execution. Encapsulate fields in DatabaseClient builders.