io.vertx.rxjava.ext.sql

## Class SQLClientHelper

- java.lang.Object
- - io.vertx.rxjava.ext.sql.SQLClientHelper

-     public class SQLClientHelper
      extends Object

  Utilities for generating observables with a `SQLClient`.
  Author:
    Thomas Segismont

- - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static Completable` | `inTransactionCompletable(SQLClient client, java.util.function.Function<SQLConnection,Completable> sourceSupplier)` Generates a `Completable` from `SQLConnection` operations executed inside a transaction.
    `static <T> Observable<T>` | `inTransactionObservable(SQLClient client, java.util.function.Function<SQLConnection,Observable<T>> sourceSupplier)` Generates a `Observable` from `SQLConnection` operations executed inside a transaction.
    `static <T> Single<T>` | `inTransactionSingle(SQLClient client, java.util.function.Function<SQLConnection,Single<T>> sourceSupplier)` Generates a `Single` from `SQLConnection` operations executed inside a transaction.
    `static Completable.Transformer` | `txCompletableTransformer(SQLConnection sqlConnection)` Creates a `Completable.Transformer` decorating a `Completable` with transaction management for a given `SQLConnection`.
    `static <T> Observable.Transformer<T,T>` | `txObservableTransformer(SQLConnection sqlConnection)` Creates a `Observable.Transformer` decorating an `Observable` with transaction management for a given `SQLConnection`.
    `static <T> Single.Transformer<T,T>` | `txSingleTransformer(SQLConnection sqlConnection)` Creates a `Single.Transformer` decorating a `Single` with transaction management for a given `SQLConnection`.
    `static Completable` | `usingConnectionCompletable(SQLClient client, java.util.function.Function<SQLConnection,Completable> sourceSupplier)` Generates a `Completable` from `SQLConnection` operations.
    `static <T> Observable<T>` | `usingConnectionObservable(SQLClient client, java.util.function.Function<SQLConnection,Observable<T>> sourceSupplier)` Generates a `Observable` from `SQLConnection` operations.
    `static <T> Single<T>` | `usingConnectionSingle(SQLClient client, java.util.function.Function<SQLConnection,Single<T>> sourceSupplier)` Generates a `Single` from `SQLConnection` operations.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### txObservableTransformer

          public static <T> Observable.Transformer<T,T> txObservableTransformer(SQLConnection sqlConnection)

      Creates a `Observable.Transformer` decorating an `Observable` with transaction management for a given `SQLConnection`.

      If the upstream `Observable` completes (onComplete), the transaction is committed. If the upstream `Observable` 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 upstream `Observable`
      Parameters:
        `sqlConnection` - the `SQLConnection` used for database operations and transaction management
      Returns:
        a `Observable.Transformer` decorating an `Observable` with transaction management

    - #### inTransactionObservable

          public static <T> Observable<T> inTransactionObservable(SQLClient client,
                                                                  java.util.function.Function<SQLConnection,Observable<T>> sourceSupplier)

      Generates a `Observable` from `SQLConnection` operations executed inside a transaction.
      Type Parameters:
        `T` - the type of the items emitted by the `Observable`
      Parameters:
        `client` - the `SQLClient`
        `sourceSupplier` - a user-provided function returning a `Observable` generated by interacting with the given `SQLConnection`
      Returns:
        an `Observable` generated from `SQLConnection` operations executed inside a transaction

    - #### txSingleTransformer

          public static <T> Single.Transformer<T,T> txSingleTransformer(SQLConnection sqlConnection)

      Creates a `Single.Transformer` decorating a `Single` with transaction management for a given `SQLConnection`.

      If the upstream `Single` emits a value (onSuccess), the transaction is committed. If the upstream `Single` 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 upstream `Single`
      Parameters:
        `sqlConnection` - the `SQLConnection` used for database operations and transaction management
      Returns:
        a `Single.Transformer` decorating a `Single` with transaction management

    - #### inTransactionSingle

          public static <T> Single<T> inTransactionSingle(SQLClient client,
                                                          java.util.function.Function<SQLConnection,Single<T>> sourceSupplier)

      Generates a `Single` from `SQLConnection` operations executed inside a transaction.
      Type Parameters:
        `T` - the type of the item emitted by the `Single`
      Parameters:
        `client` - the `SQLClient`
        `sourceSupplier` - a user-provided function returning a `Single` generated by interacting with the given `SQLConnection`
      Returns:
        a `Single` generated from `SQLConnection` operations executed inside a transaction

    - #### txCompletableTransformer

          public static Completable.Transformer txCompletableTransformer(SQLConnection sqlConnection)

      Creates a `Completable.Transformer` decorating a `Completable` with transaction management for a given `SQLConnection`.

      If the upstream `Completable` completes (onComplete), the transaction is committed. If the upstream `Completable` emits an error (onError), the transaction is rollbacked.

      Eventually, the given `SQLConnection` is put back in autocommit mode.

      Parameters:
        `sqlConnection` - the `SQLConnection` used for database operations and transaction management
      Returns:
        a `Completable.Transformer` decorating a `Completable` with transaction management

    - #### inTransactionCompletable

          public static Completable inTransactionCompletable(SQLClient client,
                                                             java.util.function.Function<SQLConnection,Completable> sourceSupplier)

      Generates a `Completable` from `SQLConnection` operations executed inside a transaction.
      Parameters:
        `client` - the `SQLClient`
        `sourceSupplier` - a user-provided function returning a `Completable` generated by interacting with the given `SQLConnection`
      Returns:
        a `Completable` generated from `SQLConnection` operations executed inside a transaction

    - #### usingConnectionObservable

          public static <T> Observable<T> usingConnectionObservable(SQLClient client,
                                                                    java.util.function.Function<SQLConnection,Observable<T>> sourceSupplier)

      Generates a `Observable` from `SQLConnection` operations.
      Type Parameters:
        `T` - the type of the items emitted by the `Observable`
      Parameters:
        `client` - the `SQLClient`
        `sourceSupplier` - a user-provided function returning a `Observable` generated by interacting with the given `SQLConnection`
      Returns:
        an `Observable` generated from `SQLConnection` operations

    - #### usingConnectionSingle

          public static <T> Single<T> usingConnectionSingle(SQLClient client,
                                                            java.util.function.Function<SQLConnection,Single<T>> sourceSupplier)

      Generates a `Single` from `SQLConnection` operations.
      Type Parameters:
        `T` - the type of the item emitted by the `Single`
      Parameters:
        `client` - the `SQLClient`
        `sourceSupplier` - a user-provided function returning a `Single` generated by interacting with the given `SQLConnection`
      Returns:
        a `Single` generated from `SQLConnection` operations

    - #### usingConnectionCompletable

          public static Completable usingConnectionCompletable(SQLClient client,
                                                               java.util.function.Function<SQLConnection,Completable> sourceSupplier)

      Generates a `Completable` from `SQLConnection` operations.
      Parameters:
        `client` - the `SQLClient`
        `sourceSupplier` - a user-provided function returning a `Completable` generated by interacting with the given `SQLConnection`
      Returns:
        a `Completable` generated from `SQLConnection` operations

Copyright © 2021 Eclipse. All rights reserved.