-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
151 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
core/src/main/java/io/github/zero88/jooqx/JooqxSession.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package io.github.zero88.jooqx; | ||
|
||
import java.util.function.Function; | ||
|
||
import org.jetbrains.annotations.NotNull; | ||
|
||
import io.vertx.codegen.annotations.VertxGen; | ||
import io.vertx.core.Future; | ||
import io.vertx.sqlclient.SqlConnection; | ||
import io.vertx.sqlclient.Tuple; | ||
|
||
/** | ||
* @since 2.0.0 | ||
*/ | ||
@VertxGen | ||
public interface JooqxSession extends JooqxConn, | ||
SQLSessionExecutor<SqlConnection, Tuple, JooqxPreparedQuery, | ||
JooqxResultCollector, JooqxSession> { | ||
|
||
@Override | ||
default @NotNull JooqxSession session() { return this; } | ||
|
||
@Override | ||
<R> Future<R> session(@NotNull Function<JooqxSession, Future<R>> function); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
core/src/main/java/io/github/zero88/jooqx/LegacyJooqxSession.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package io.github.zero88.jooqx; | ||
|
||
import java.util.function.Function; | ||
|
||
import org.jetbrains.annotations.NotNull; | ||
|
||
import io.vertx.codegen.annotations.VertxGen; | ||
import io.vertx.core.Future; | ||
import io.vertx.core.json.JsonArray; | ||
import io.vertx.ext.sql.SQLConnection; | ||
|
||
/** | ||
* @since 2.0.0 | ||
*/ | ||
@Deprecated | ||
@VertxGen | ||
public interface LegacyJooqxSession extends LegacyInternal<SQLConnection>, | ||
SQLSessionExecutor<SQLConnection, JsonArray, LegacySQLPreparedQuery, | ||
LegacySQLCollector, LegacyJooqxSession> { | ||
|
||
@Override | ||
default @NotNull LegacyJooqxSession session() { return this; } | ||
|
||
@Override | ||
<R> Future<R> session(@NotNull Function<LegacyJooqxSession, Future<R>> function); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
core/src/main/java/io/github/zero88/jooqx/SQLSessionExecutor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package io.github.zero88.jooqx; | ||
|
||
import java.util.function.Function; | ||
|
||
import org.jetbrains.annotations.NotNull; | ||
|
||
import io.vertx.core.AsyncResult; | ||
import io.vertx.core.Future; | ||
import io.vertx.core.Handler; | ||
|
||
public interface SQLSessionExecutor<S, B, P extends SQLPreparedQuery<B>, C extends SQLResultCollector, | ||
E extends SQLExecutor<S, B, P, C>> { | ||
|
||
/** | ||
* Run the session code | ||
* | ||
* @param function session function | ||
* @param handler handler | ||
* @param <R> Type of result | ||
*/ | ||
default <R> void session(@NotNull Function<E, Future<R>> function, @NotNull Handler<AsyncResult<R>> handler) { | ||
session(function).onComplete(handler); | ||
} | ||
|
||
/** | ||
* Like {@link #session(Function, Handler)} but returns a {@code Future} of the asynchronous result | ||
* | ||
* @param function session function | ||
* @param <R> Type of result | ||
* @return a {@code Future} of the asynchronous result | ||
*/ | ||
<R> Future<R> session(@NotNull Function<E, Future<R>> function); | ||
|
||
} |