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.CompletableinTransactionCompletable(SQLClient client, Function<SQLConnection,rx.Completable> sourceSupplier)Generates aCompletablefromSQLConnectionoperations executed inside a transaction.static <T> rx.Observable<T>inTransactionObservable(SQLClient client, Function<SQLConnection,rx.Observable<T>> sourceSupplier)Generates aObservablefromSQLConnectionoperations executed inside a transaction.static <T> rx.Single<T>inTransactionSingle(SQLClient client, Function<SQLConnection,rx.Single<T>> sourceSupplier)Generates aSinglefromSQLConnectionoperations executed inside a transaction.static rx.Completable.TransformertxCompletableTransformer(SQLConnection sqlConnection)Creates aCompletable.Transformerdecorating aCompletablewith transaction management for a givenSQLConnection.static <T> rx.Observable.Transformer<T,T>txObservableTransformer(SQLConnection sqlConnection)Creates aObservable.Transformerdecorating anObservablewith transaction management for a givenSQLConnection.static <T> rx.Single.Transformer<T,T>txSingleTransformer(SQLConnection sqlConnection)Creates aSingle.Transformerdecorating aSinglewith transaction management for a givenSQLConnection.static rx.CompletableusingConnectionCompletable(SQLClient client, Function<SQLConnection,rx.Completable> sourceSupplier)Generates aCompletablefromSQLConnectionoperations.static <T> rx.Observable<T>usingConnectionObservable(SQLClient client, Function<SQLConnection,rx.Observable<T>> sourceSupplier)Generates aObservablefromSQLConnectionoperations.static <T> rx.Single<T>usingConnectionSingle(SQLClient client, Function<SQLConnection,rx.Single<T>> sourceSupplier)Generates aSinglefromSQLConnectionoperations.
-
-
-
Method Detail
-
txObservableTransformer
public static <T> rx.Observable.Transformer<T,T> txObservableTransformer(SQLConnection sqlConnection)
Creates aObservable.Transformerdecorating anObservablewith transaction management for a givenSQLConnection.If the upstream
Observablecompletes (onComplete), the transaction is committed. If the upstreamObservableemits an error (onError), the transaction is rollbacked.Eventually, the given
SQLConnectionis put back in autocommit mode.- Type Parameters:
T- the type of the items emitted by the upstreamObservable- Parameters:
sqlConnection- theSQLConnectionused for database operations and transaction management- Returns:
- a
Observable.Transformerdecorating anObservablewith transaction management
-
inTransactionObservable
public static <T> rx.Observable<T> inTransactionObservable(SQLClient client, Function<SQLConnection,rx.Observable<T>> sourceSupplier)
Generates aObservablefromSQLConnectionoperations executed inside a transaction.- Type Parameters:
T- the type of the items emitted by theObservable- Parameters:
client- theSQLClientsourceSupplier- a user-provided function returning aObservablegenerated by interacting with the givenSQLConnection- Returns:
- an
Observablegenerated fromSQLConnectionoperations executed inside a transaction
-
txSingleTransformer
public static <T> rx.Single.Transformer<T,T> txSingleTransformer(SQLConnection sqlConnection)
Creates aSingle.Transformerdecorating aSinglewith transaction management for a givenSQLConnection.If the upstream
Singleemits a value (onSuccess), the transaction is committed. If the upstreamSingleemits an error (onError), the transaction is rollbacked.Eventually, the given
SQLConnectionis put back in autocommit mode.- Type Parameters:
T- the type of the item emitted by the upstreamSingle- Parameters:
sqlConnection- theSQLConnectionused for database operations and transaction management- Returns:
- a
Single.Transformerdecorating aSinglewith transaction management
-
inTransactionSingle
public static <T> rx.Single<T> inTransactionSingle(SQLClient client, Function<SQLConnection,rx.Single<T>> sourceSupplier)
Generates aSinglefromSQLConnectionoperations executed inside a transaction.- Type Parameters:
T- the type of the item emitted by theSingle- Parameters:
client- theSQLClientsourceSupplier- a user-provided function returning aSinglegenerated by interacting with the givenSQLConnection- Returns:
- a
Singlegenerated fromSQLConnectionoperations executed inside a transaction
-
txCompletableTransformer
public static rx.Completable.Transformer txCompletableTransformer(SQLConnection sqlConnection)
Creates aCompletable.Transformerdecorating aCompletablewith transaction management for a givenSQLConnection.If the upstream
Completablecompletes (onComplete), the transaction is committed. If the upstreamCompletableemits an error (onError), the transaction is rollbacked.Eventually, the given
SQLConnectionis put back in autocommit mode.- Parameters:
sqlConnection- theSQLConnectionused for database operations and transaction management- Returns:
- a
Completable.Transformerdecorating aCompletablewith transaction management
-
inTransactionCompletable
public static rx.Completable inTransactionCompletable(SQLClient client, Function<SQLConnection,rx.Completable> sourceSupplier)
Generates aCompletablefromSQLConnectionoperations executed inside a transaction.- Parameters:
client- theSQLClientsourceSupplier- a user-provided function returning aCompletablegenerated by interacting with the givenSQLConnection- Returns:
- a
Completablegenerated fromSQLConnectionoperations executed inside a transaction
-
usingConnectionObservable
public static <T> rx.Observable<T> usingConnectionObservable(SQLClient client, Function<SQLConnection,rx.Observable<T>> sourceSupplier)
Generates aObservablefromSQLConnectionoperations.- Type Parameters:
T- the type of the items emitted by theObservable- Parameters:
client- theSQLClientsourceSupplier- a user-provided function returning aObservablegenerated by interacting with the givenSQLConnection- Returns:
- an
Observablegenerated fromSQLConnectionoperations
-
usingConnectionSingle
public static <T> rx.Single<T> usingConnectionSingle(SQLClient client, Function<SQLConnection,rx.Single<T>> sourceSupplier)
Generates aSinglefromSQLConnectionoperations.- Type Parameters:
T- the type of the item emitted by theSingle- Parameters:
client- theSQLClientsourceSupplier- a user-provided function returning aSinglegenerated by interacting with the givenSQLConnection- Returns:
- a
Singlegenerated fromSQLConnectionoperations
-
usingConnectionCompletable
public static rx.Completable usingConnectionCompletable(SQLClient client, Function<SQLConnection,rx.Completable> sourceSupplier)
Generates aCompletablefromSQLConnectionoperations.- Parameters:
client- theSQLClientsourceSupplier- a user-provided function returning aCompletablegenerated by interacting with the givenSQLConnection- Returns:
- a
Completablegenerated fromSQLConnectionoperations
-
-