Giter Club home page Giter Club logo

spring-boot-data-r2dbc-jooq's People

Contributors

gofabian avatar steph-beneschan-256 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

spring-boot-data-r2dbc-jooq's Issues

Separate record logic and query logic

Introduce two new classes that contain the whole logic:

  • QueryExecutor(DSLContext)
  • RecordExecutor(DSLContext)

The main class should not contain any logic but only invoke the executors:

  • ReactiveJooq used in a static context

Code generation

  • Reactive DAOs
  • Reactive table records

This could also be an alternative for Kotlin extensions but with Vanilla Java.

`executeReturningOne` is inconsistent with `fetchOne`

While fetchOne is returning at most 1 record it also fails if more than 1 record is returned by the query.
The latter is not true for executeReturningOne, it actually behaves like fetchAny.

Should be trivial to change executeReturningOne to return Mono.error in case of more than 1 record or maybe just replace the whole method with return executeReturning(query).singleOrEmpty().

`fetchExists` is returning empty `Mono` instead of `Mono` containing `false`

When a query yields records then fetchExists behaves as expected (returns Mono containing true).
However, when there are no records fetchExists returns an empty Mono instead of Mono containing false.

In particular the code return fetchOne(existsQuery).map(Objects::nonNull) should be changed to return fetchOne(existsQuery).hasElement(). A Mono's element is never null so .map(Objects::nonNull) either does nothing (for empty Mono) or maps to true.

Typo in readme

It is only intended to generate SQL strings which is given to the R2DBC database client for execution.

... strings.. is given...

Long term support?

Hello Fabian, hope you are great!,
I have spent a lot of time trying to get some answers about jooq + reactive programming, I have look into R2DBC, but since a have all my repositories running with jooq I dont want to change to R2DBC directly, so my question is do you have some plans in future about this library? Also is this library was deployed in some production env?

Functional style

Hi @gofabian I do have some comments/suggestions if you want to discuss, is all related to verbosity and functional style

for (Object key : configuration.data().keySet()) {

You can turn that into this, since this is all a lazy evaluation when the first match happen the execution is completed, you can also another indirection layer with Optional.ofNullable(configuration.data()) I know that method is unused so is perfect because we can avoid side effects

return configuration.data().keySet().stream() .filter(keyString::equals) .findFirst();

public Mono<Integer> store(UpdatableRecord<?> record) {

Or even that into this

boolean executeUpdate = Arrays.stream(record.getTable().getPrimaryKey().getFieldsArray()) .noneMatch(field -> isNewRecord(record, field));

Reference https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/stream/Stream.html#noneMatch(java.util.function.Predicate)

jOOQ 3.15 support for R2DBC

Hi there, and thanks a lot for your efforts!

jOOQ 3.15 will support R2DBC out of the box: jOOQ/jOOQ#11700. Have you been able to play with the current integration? I'd be curious to hear your thoughts and get your opinion on any potential missing features (see also known limitations: jOOQ/jOOQ#11717) here or on the jOOQ issue tracker.

Add support for queries using `*ResultStep#returningResult`

In JOOQ there are 2 general ways to declare the returning clause (for update/insert/delete). Those are [Insert|Update|Delete]ResultStep#returning and [Insert|Update|Delete]ResultStep#returningResult where the latter is to allow returning different record type than the one representing the table (e.g. Record1<UUID> instead of UserRecord with just one field actually present (if that's all you need)).

Currently only the first approach is supported. It would be useful to support the latter as well because it currently fails with ClassCastException at runtime. Example output: java.lang.ClassCastException: class com...model.tables.records.UserRecord cannot be cast to class org.jooq.Record1

Add executeReturning() and executeReturningOne() for insert/update

ReactiveJooq.executeReturning(InsertResultStep) -> Flux<Record>
ReactiveJooq.executeReturning(UpdateResultStep) -> Flux<Record>
ReactiveJooq.executeReturningOne(InsertResultStep) -> Mono<Record>
ReactiveJooq.executeReturningOne(UpdateResultStep) -> Mono<Record>

Wrong decode mechanism when using custom AbstractCodec based on field type

since you always decode an object with the target Object.class type, io.r2dbc.postgresql.codec.AbstractCodec doesn't work anymore with extra registred codec based on this implementation since io.r2dbc.postgresql.codec.AbstractCodec#canDecode is based on field type and you always pass Object.class type.

Use Spring Boot 2.3's GA Version

Current project depends on Spring Boot 2.3.0.M4, which makes it necessary to add https://repo.spring.io/milestone as a repository. Spring Boot 2.3 already went GA, thus it will be more convenience to use if the project's dependency is updated.

PostrgreSQL JSONB Support

I've been trying to convert my jooq based application from jdbc to r2dbc using this library. However I encountered an issue regarding r2dbc-postgresql. Here is the response of Netty to one of my select queries to the database containing one JSONB data type in PostgreSQL.

{ "timestamp": "time_stamp_here", "path": "request_path_here", "status": 500, "error": "Internal Server Error", "message": "Cannot convert from JsonOutput{{database_json_content_ere}} (class io.r2dbc.postgresql.codec.Json$JsonOutput) to class org.jooq.JSONB", "requestId": "request_id_here" }

Any ideas on how to fix this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.