此版本仍在开发中,尚未被视为稳定版本。对于最新的稳定版本,请使用 Spring Data Relational 3.4.5spring-doc.cadn.net.cn

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.spring-doc.cadn.net.cn

To retrieve a list of SWCharacter objects in Java, you would normally write the following:spring-doc.cadn.net.cn

Flux<SWCharacter> characters = client.select().from(SWCharacter.class).fetch().all();

With Kotlin and the Spring Data extensions, you can instead write the following:spring-doc.cadn.net.cn

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-doc.cadn.net.cn

Spring Data R2DBC provides the following extensions:spring-doc.cadn.net.cn