View Javadoc
1   package org.davidmoten.rx.jdbc;
2   
3   import javax.annotation.Nonnull;
4   
5   import com.github.davidmoten.guavamini.Preconditions;
6   
7   import io.reactivex.Flowable;
8   
9   public final class ReturnGeneratedKeysBuilder implements Getter {
10  
11      private final UpdateBuilder update;
12  
13      ReturnGeneratedKeysBuilder(@Nonnull UpdateBuilder update) {
14          this.update = update;
15      }
16  
17      /**
18       * Transforms the results using the given function.
19       *
20       * @param mapper
21       *            maps the query result to an object
22       * @return the results of the query as an Observable
23       */
24      @Override
25      public <T> Flowable<T> get(@Nonnull ResultSetMapper<? extends T> mapper) {
26          Preconditions.checkNotNull(mapper, "mapper cannot be null");
27          return update.startWithDependency(Update.<T>createReturnGeneratedKeys(update.connections,
28                  update.parameterGroupsToFlowable(), update.sql, mapper, true));
29  
30      }
31  
32  }