com.github.davidmoten.rx.jdbc.QueryUpdateTransformer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of rxjava-jdbc Show documentation
Show all versions of rxjava-jdbc Show documentation
rx-java Observables for jdbc
package com.github.davidmoten.rx.jdbc;
import com.github.davidmoten.rx.jdbc.QueryUpdate.Builder;
import rx.Observable;
import rx.Observable.Transformer;
/**
* {@link Transformer} corresonding to {@link QueryUpdateOperation}.
*/
final class QueryUpdateTransformer implements Transformer {
private final Builder builder;
private final OperatorType operatorType;
/**
* Constructor.
*
* @param builder
* @param operatorType
*/
QueryUpdateTransformer(final QueryUpdate.Builder builder, final OperatorType operatorType) {
this.builder = builder;
this.operatorType = operatorType;
}
@Override
public Observable call(Observable source) {
if (operatorType == OperatorType.PARAMETER)
return builder.parameters(source).count();
else if (operatorType == OperatorType.DEPENDENCY)
// dependency
return builder.dependsOn(source).count();
else
throw new RuntimeException("does not handle " + operatorType);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy