Skip to content

Commit 4e7ebbd

Browse files
committed
Merge branch 'r2dbc'
2 parents dc72621 + afde1ad commit 4e7ebbd

File tree

363 files changed

+33255
-35
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

363 files changed

+33255
-35
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ jobs:
146146
- run:
147147
name: 'Test'
148148
command: |
149-
./mvnw -ntp -B install -Pquickbuild -pl :querydsl-sql-spring,:querydsl-jpa-spring,:querydsl-kotlin-codegen,:querydsl-mongodb -am -T2
149+
./mvnw -ntp -B install -Pquickbuild -pl :querydsl-sql-spring,:querydsl-jpa-spring,:querydsl-kotlin-codegen,:querydsl-mongodb,:querydsl-r2dbc -am -T2
150150
./mvnw -ntp -B verify -Pexamples -rf :querydsl-examples
151151
- save-test-results
152152
buildQuarkusExample:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ derby.log
2222
/devops/test-connection/.lein-repl-history
2323
**/.flattened-pom.xml
2424

25+
.java-version
2526
.gitignore
2627
.checkstyle
2728

pom.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
<module>querydsl-sql-spatial</module>
8080
<module>querydsl-sql-codegen</module>
8181
<module>querydsl-sql-spring</module>
82+
<module>querydsl-r2dbc</module>
8283

8384
<module>querydsl-jpa</module>
8485
<module>querydsl-jpa-codegen</module>
@@ -155,6 +156,8 @@
155156
<firebird.version>5.0.3.java11</firebird.version>
156157
<mongodb.version>3.12.14</mongodb.version>
157158

159+
<r2dbc.version>1.0.0.RELEASE</r2dbc.version>
160+
158161
<!-- JPA deps -->
159162
<hibernate.version>6.4.4.Final</hibernate.version>
160163
<hibernate.validator.version>8.0.1.Final</hibernate.validator.version>
@@ -292,6 +295,13 @@
292295
<type>pom</type>
293296
<scope>import</scope>
294297
</dependency>
298+
<dependency>
299+
<groupId>io.projectreactor</groupId>
300+
<artifactId>reactor-bom</artifactId>
301+
<version>2023.0.3</version>
302+
<type>pom</type>
303+
<scope>import</scope>
304+
</dependency>
295305
</dependencies>
296306
</dependencyManagement>
297307

querydsl-core/pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@
2828
<artifactId>classgraph</artifactId>
2929
<scope>test</scope>
3030
</dependency>
31+
<dependency>
32+
<groupId>io.projectreactor</groupId>
33+
<artifactId>reactor-core</artifactId>
34+
</dependency>
3135

3236
<!-- alias dependencies -->
3337
<dependency>
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
package com.querydsl.core;
2+
3+
import reactor.core.publisher.Flux;
4+
import reactor.core.publisher.Mono;
5+
6+
/**
7+
* {@code ReactiveFetchable} defines default projection methods for {@link Query} implementations.
8+
* All Querydsl query implementations should implement this interface.
9+
*
10+
* @param <T> result type
11+
*/
12+
public interface ReactiveFetchable<T> {
13+
14+
/**
15+
* Get the projection as a typed Flux.
16+
*
17+
* @return result
18+
*/
19+
Flux<T> fetch();
20+
21+
/**
22+
* Get the first result of the projection.
23+
*
24+
* @return first result
25+
*/
26+
Mono<T> fetchFirst();
27+
28+
/**
29+
* Get the projection as a unique result.
30+
*
31+
* @return first result
32+
*/
33+
Mono<T> fetchOne();
34+
35+
/**
36+
* Get the count of matched elements
37+
*
38+
* @return row count
39+
*/
40+
Mono<Long> fetchCount();
41+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
package com.querydsl.core;
2+
3+
import com.querydsl.core.types.Expression;
4+
import org.reactivestreams.Publisher;
5+
6+
/**
7+
* {@code FetchableQuery} extends {@link ReactiveFetchable} and {@link SimpleQuery} with projection
8+
* changing methods and result aggregation functionality using {@link ResultTransformer} instances.
9+
*
10+
* @param <T> element type
11+
* @param <Q> concrete subtype
12+
*/
13+
public interface ReactiveFetchableQuery<T, Q extends ReactiveFetchableQuery<T, Q>>
14+
extends SimpleQuery<Q>, ReactiveFetchable<T> {
15+
16+
/**
17+
* Change the projection of this query
18+
*
19+
* @param <U>
20+
* @param expr new projection
21+
* @return the current object
22+
*/
23+
<U> ReactiveFetchableQuery<U, ?> select(Expression<U> expr);
24+
25+
/**
26+
* Change the projection of this query
27+
*
28+
* @param exprs new projection
29+
* @return the current object
30+
*/
31+
ReactiveFetchableQuery<Tuple, ?> select(Expression<?>... exprs);
32+
33+
/**
34+
* Apply the given transformer to this {@code ReactiveFetchableQuery} instance and return the
35+
* results
36+
*
37+
* @param <S>
38+
* @param transformer result transformer
39+
* @return transformed result
40+
*/
41+
<S> Publisher<S> transform(ReactiveResultTransformer<S> transformer);
42+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* Copyright 2015, The Querydsl Team (http://www.querydsl.com/team)
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
* Unless required by applicable law or agreed to in writing, software
9+
* distributed under the License is distributed on an "AS IS" BASIS,
10+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
* See the License for the specific language governing permissions and
12+
* limitations under the License.
13+
*/
14+
package com.querydsl.core;
15+
16+
import org.reactivestreams.Publisher;
17+
18+
/**
19+
* Executes query on a {@link ReactiveFetchableQuery} and transforms results into T. This can be
20+
* used for example to group projected columns or to filter out duplicate results.
21+
*
22+
* @param <T> Transformations target type
23+
* @author sasa
24+
* @see com.querydsl.core.group.GroupBy
25+
*/
26+
public interface ReactiveResultTransformer<T> {
27+
28+
/**
29+
* Execute the given query and transform the results
30+
*
31+
* @param query query to be used for execution
32+
* @return transformed results
33+
*/
34+
Publisher<T> transform(ReactiveFetchableQuery<?, ?> query);
35+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package com.querydsl.core.dml;
2+
3+
import reactor.core.publisher.Mono;
4+
5+
/**
6+
* Parent interface for DML clauses
7+
*
8+
* @param <C> concrete subtype
9+
*/
10+
public interface ReactiveDMLClause<C extends ReactiveDMLClause<C>> {
11+
12+
/**
13+
* Execute the clause and return the amount of affected rows
14+
*
15+
* @return amount of affected rows or empty if not available
16+
*/
17+
Mono<Long> execute();
18+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package com.querydsl.core.dml;
2+
3+
/**
4+
* {@code ReactiveDeleteClause} defines a generic interface for Delete clauses
5+
*
6+
* @param <C> concrete subtype
7+
*/
8+
public interface ReactiveDeleteClause<C extends ReactiveDeleteClause<C>>
9+
extends ReactiveDMLClause<C>, ReactiveFilteredClause<C> {}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package com.querydsl.core.dml;
2+
3+
import com.querydsl.core.types.Predicate;
4+
5+
/**
6+
* {@code ReactiveFilteredClause} is an interface for clauses with a filter condition
7+
*
8+
* @param <C> concrete subtype
9+
*/
10+
public interface ReactiveFilteredClause<C extends ReactiveFilteredClause<C>> {
11+
12+
/**
13+
* Adds the given filter conditions
14+
*
15+
* <p>Skips null arguments
16+
*
17+
* @param o filter conditions to be added
18+
* @return the current object
19+
*/
20+
C where(Predicate... o);
21+
}

0 commit comments

Comments
 (0)