Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

License

NotificationsYou must be signed in to change notification settings

udaan-com/r2dbi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

R2Dbi is a Kotlin library inspired byJDBI and built on Reactive Relational Database Connectivity (R2DBC) SPI.R2DBC bringsReactive Programming APIs to relational databases. R2DBI simplifies database operations by offering adeclarative style similar toJDBI SqlObjects.It provides easy-to-use interfaces for executingSQL queries and mappingdata toobjects.

While primarily designed for Kotlin, it may also work with Java, although it hasn't been tested yet.R2dbi started out to be used in declarative mode (ie define an annotatedinterface). The fluent interface is stillbeing developed and hence not ready to use. It is available to experiment and play with.

License

R2Dbi is licensed under the commercial friendlyApache 2.0 license.

Basic Usage

define the SQL to execute and the shape of the results - by creating an annotatedinterface.

importkotlinx.coroutines.flow.Flowimportorg.reactivestreams.Publisherimportreactor.core.publisher.Flux// Declare the API using annotations on a Java interfaceinterfaceUserDao {// Using kotlinx.coroutines.flow.Flow    @SqlQuery("SELECT 1")fungetOne():Flow<Long>        @SqlQuery("SELECT * FROM 'user' where name = :name")funfindUser(@Bind("name")name:String):Flow<User>;// Using reactor.core.publisher.Flux    @SqlQuery("SELECT * FROM 'user'")fungetAllUsers():Flux<User>;}

This library supports bothkotlinx.coroutines.flow.Flow andorg.reactivestreams.Publisher /reactor.core.publisher.Fluxas the return type. Note that no other return type (especially blocking) is supported.

You look atTestQueryDao.kt andTestDynamicInterfaceBase.kt to checkoutmore examples.

🚧
Before utilizing this library, it's crucial to grasp the fundamentals of Coroutines and Project Reactor.
For Instance, without subscribing to aPublisher or attempting to materialize a value of aFlow, the underlying SQL query won't execute.

Building, Testing, Contributing

seeCONTRIBUTING.md

Versioning

TODO

Project Members

Shashwat Agarwal

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp