Package io.vertx.rxjava.ext.sql
Class SQLClientHelper
- java.lang.Object
-
- io.vertx.rxjava.ext.sql.SQLClientHelper
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static rx.Completable
inTransactionCompletable(SQLClient client, Function<SQLConnection,rx.Completable> sourceSupplier)
Generates aCompletable
fromSQLConnection
operations executed inside a transaction.static <T> rx.Observable<T>
inTransactionObservable(SQLClient client, Function<SQLConnection,rx.Observable<T>> sourceSupplier)
Generates aObservable
fromSQLConnection
operations executed inside a transaction.static <T> rx.Single<T>
inTransactionSingle(SQLClient client, Function<SQLConnection,rx.Single<T>> sourceSupplier)
Generates aSingle
fromSQLConnection
operations executed inside a transaction.static rx.Completable.Transformer
txCompletableTransformer(SQLConnection sqlConnection)
Creates aCompletable.Transformer
decorating aCompletable
with transaction management for a givenSQLConnection
.static <T> rx.Observable.Transformer<T,T>
txObservableTransformer(SQLConnection sqlConnection)
Creates aObservable.Transformer
decorating anObservable
with transaction management for a givenSQLConnection
.static <T> rx.Single.Transformer<T,T>
txSingleTransformer(SQLConnection sqlConnection)
Creates aSingle.Transformer
decorating aSingle
with transaction management for a givenSQLConnection
.static rx.Completable
usingConnectionCompletable(SQLClient client, Function<SQLConnection,rx.Completable> sourceSupplier)
Generates aCompletable
fromSQLConnection
operations.static <T> rx.Observable<T>
usingConnectionObservable(SQLClient client, Function<SQLConnection,rx.Observable<T>> sourceSupplier)
Generates aObservable
fromSQLConnection
operations.static <T> rx.Single<T>
usingConnectionSingle(SQLClient client, Function<SQLConnection,rx.Single<T>> sourceSupplier)
Generates aSingle
fromSQLConnection
operations.
-
-
-
Method Detail
-
txObservableTransformer
public static <T> rx.Observable.Transformer<T,T> txObservableTransformer(SQLConnection sqlConnection)
Creates aObservable.Transformer
decorating anObservable
with transaction management for a givenSQLConnection
.If the upstream
Observable
completes (onComplete), the transaction is committed. If the upstreamObservable
emits an error (onError), the transaction is rollbacked.Eventually, the given
SQLConnection
is put back in autocommit mode.- Type Parameters:
T
- the type of the items emitted by the upstreamObservable
- Parameters:
sqlConnection
- theSQLConnection
used for database operations and transaction management- Returns:
- a
Observable.Transformer
decorating anObservable
with transaction management
-
inTransactionObservable
public static <T> rx.Observable<T> inTransactionObservable(SQLClient client, Function<SQLConnection,rx.Observable<T>> sourceSupplier)
Generates aObservable
fromSQLConnection
operations executed inside a transaction.- Type Parameters:
T
- the type of the items emitted by theObservable
- Parameters:
client
- theSQLClient
sourceSupplier
- a user-provided function returning aObservable
generated by interacting with the givenSQLConnection
- Returns:
- an
Observable
generated fromSQLConnection
operations executed inside a transaction
-
txSingleTransformer
public static <T> rx.Single.Transformer<T,T> txSingleTransformer(SQLConnection sqlConnection)
Creates aSingle.Transformer
decorating aSingle
with transaction management for a givenSQLConnection
.If the upstream
Single
emits a value (onSuccess), the transaction is committed. If the upstreamSingle
emits an error (onError), the transaction is rollbacked.Eventually, the given
SQLConnection
is put back in autocommit mode.- Type Parameters:
T
- the type of the item emitted by the upstreamSingle
- Parameters:
sqlConnection
- theSQLConnection
used for database operations and transaction management- Returns:
- a
Single.Transformer
decorating aSingle
with transaction management
-
inTransactionSingle
public static <T> rx.Single<T> inTransactionSingle(SQLClient client, Function<SQLConnection,rx.Single<T>> sourceSupplier)
Generates aSingle
fromSQLConnection
operations executed inside a transaction.- Type Parameters:
T
- the type of the item emitted by theSingle
- Parameters:
client
- theSQLClient
sourceSupplier
- a user-provided function returning aSingle
generated by interacting with the givenSQLConnection
- Returns:
- a
Single
generated fromSQLConnection
operations executed inside a transaction
-
txCompletableTransformer
public static rx.Completable.Transformer txCompletableTransformer(SQLConnection sqlConnection)
Creates aCompletable.Transformer
decorating aCompletable
with transaction management for a givenSQLConnection
.If the upstream
Completable
completes (onComplete), the transaction is committed. If the upstreamCompletable
emits an error (onError), the transaction is rollbacked.Eventually, the given
SQLConnection
is put back in autocommit mode.- Parameters:
sqlConnection
- theSQLConnection
used for database operations and transaction management- Returns:
- a
Completable.Transformer
decorating aCompletable
with transaction management
-
inTransactionCompletable
public static rx.Completable inTransactionCompletable(SQLClient client, Function<SQLConnection,rx.Completable> sourceSupplier)
Generates aCompletable
fromSQLConnection
operations executed inside a transaction.- Parameters:
client
- theSQLClient
sourceSupplier
- a user-provided function returning aCompletable
generated by interacting with the givenSQLConnection
- Returns:
- a
Completable
generated fromSQLConnection
operations executed inside a transaction
-
usingConnectionObservable
public static <T> rx.Observable<T> usingConnectionObservable(SQLClient client, Function<SQLConnection,rx.Observable<T>> sourceSupplier)
Generates aObservable
fromSQLConnection
operations.- Type Parameters:
T
- the type of the items emitted by theObservable
- Parameters:
client
- theSQLClient
sourceSupplier
- a user-provided function returning aObservable
generated by interacting with the givenSQLConnection
- Returns:
- an
Observable
generated fromSQLConnection
operations
-
usingConnectionSingle
public static <T> rx.Single<T> usingConnectionSingle(SQLClient client, Function<SQLConnection,rx.Single<T>> sourceSupplier)
Generates aSingle
fromSQLConnection
operations.- Type Parameters:
T
- the type of the item emitted by theSingle
- Parameters:
client
- theSQLClient
sourceSupplier
- a user-provided function returning aSingle
generated by interacting with the givenSQLConnection
- Returns:
- a
Single
generated fromSQLConnection
operations
-
usingConnectionCompletable
public static rx.Completable usingConnectionCompletable(SQLClient client, Function<SQLConnection,rx.Completable> sourceSupplier)
Generates aCompletable
fromSQLConnection
operations.- Parameters:
client
- theSQLClient
sourceSupplier
- a user-provided function returning aCompletable
generated by interacting with the givenSQLConnection
- Returns:
- a
Completable
generated fromSQLConnection
operations
-
-