This version is still in development and is not considered stable yet. For the latest stable version, please use Spring Data Relational 3.4.1! |
Kotlin
This part of the reference documentation explains the specific Kotlin functionality offered by Spring Data R2DBC. See Kotlin Support for the general functionality provided by Spring Data.
To retrieve a list of SWCharacter
objects in Java, you would normally write the following:
Flux<SWCharacter> characters = client.select().from(SWCharacter.class).fetch().all();
With Kotlin and the Spring Data extensions, you can instead write the following:
val characters = client.select().from<SWCharacter>().fetch().all()
// or (both are equivalent)
val characters : Flux<SWCharacter> = client.select().from().fetch().all()
As in Java, characters
in Kotlin is strongly typed, but Kotlin’s clever type inference allows for shorter syntax.
Spring Data R2DBC provides the following extensions:
-
Reified generics support for
DatabaseClient
andCriteria
. -
Coroutines extensions for
DatabaseClient
.