diff --git a/src/main/asciidoc/index.adoc b/src/main/asciidoc/index.adoc index 4390c21..0970638 100644 --- a/src/main/asciidoc/index.adoc +++ b/src/main/asciidoc/index.adoc @@ -36,4 +36,8 @@ include::reference/r2dbc-repositories.adoc[leveloffset=+1] include::reference/r2dbc-connections.adoc[leveloffset=+1] +include::reference/r2dbc-initialization.adoc[leveloffset=+1] + include::reference/mapping.adoc[leveloffset=+1] + +include::reference/kotlin.adoc[leveloffset=+1] diff --git a/src/main/asciidoc/reference/kotlin.adoc b/src/main/asciidoc/reference/kotlin.adoc new file mode 100644 index 0000000..c64b3b4 --- /dev/null +++ b/src/main/asciidoc/reference/kotlin.adoc @@ -0,0 +1,28 @@ +include::../{spring-data-commons-docs}/kotlin.adoc[] + +include::../{spring-data-commons-docs}/kotlin-extensions.adoc[leveloffset=+1] + +To retrieve a list of `SWCharacter` objects in Java, you would normally write the following: + +[source,java] +---- +Flux characters = client.select().from(SWCharacter.class).fetch().all(); +---- + +With Kotlin and the Spring Data extensions, you can instead write the following: + +[source,kotlin] +---- +val characters = client.select().from().fetch().all() +// or (both are equivalent) +val characters : Flux = 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` and `Criteria`. +* <> extensions for `DatabaseClient`. + +include::../{spring-data-commons-docs}/kotlin-coroutines.adoc[leveloffset=+1]