change version and add more scala future methods
This commit is contained in:
parent
869fd0aae3
commit
a4260436e8
4 changed files with 85 additions and 2 deletions
2
pom.xml
2
pom.xml
|
@ -5,7 +5,7 @@
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>com.noorq.casser</groupId>
|
<groupId>com.noorq.casser</groupId>
|
||||||
<artifactId>casser-core</artifactId>
|
<artifactId>casser-core</artifactId>
|
||||||
<version>1.1.0-SNAPSHOT</version>
|
<version>1.1.0_2.11-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>casser</name>
|
<name>casser</name>
|
||||||
|
|
|
@ -24,6 +24,7 @@ import com.google.common.base.Function;
|
||||||
import com.google.common.util.concurrent.Futures;
|
import com.google.common.util.concurrent.Futures;
|
||||||
import com.google.common.util.concurrent.ListenableFuture;
|
import com.google.common.util.concurrent.ListenableFuture;
|
||||||
import com.noorq.casser.core.AbstractSessionOperations;
|
import com.noorq.casser.core.AbstractSessionOperations;
|
||||||
|
import com.noorq.casser.support.Fun;
|
||||||
import com.noorq.casser.support.Scala;
|
import com.noorq.casser.support.Scala;
|
||||||
|
|
||||||
public abstract class AbstractOperation<E, O extends AbstractOperation<E, O>> extends AbstractStatementOperation<E, O> {
|
public abstract class AbstractOperation<E, O extends AbstractOperation<E, O>> extends AbstractStatementOperation<E, O> {
|
||||||
|
@ -57,6 +58,22 @@ public abstract class AbstractOperation<E, O extends AbstractOperation<E, O>> ex
|
||||||
return Scala.asFuture(prepareAsync());
|
return Scala.asFuture(prepareAsync());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public <A> Future<Fun.Tuple2<PreparedOperation<E>, A>> prepareFuture(A a) {
|
||||||
|
return Scala.asFuture(prepareAsync(), a);
|
||||||
|
}
|
||||||
|
|
||||||
|
public <A, B> Future<Fun.Tuple3<PreparedOperation<E>, A, B>> prepareFuture(A a, B b) {
|
||||||
|
return Scala.asFuture(prepareAsync(), a, b);
|
||||||
|
}
|
||||||
|
|
||||||
|
public <A, B, C> Future<Fun.Tuple4<PreparedOperation<E>, A, B, C>> prepareFuture(A a, B b, C c) {
|
||||||
|
return Scala.asFuture(prepareAsync(), a, b, c);
|
||||||
|
}
|
||||||
|
|
||||||
|
public <A, B, C, D> Future<Fun.Tuple5<PreparedOperation<E>, A, B, C, D>> prepareFuture(A a, B b, C c, D d) {
|
||||||
|
return Scala.asFuture(prepareAsync(), a, b, c, d);
|
||||||
|
}
|
||||||
|
|
||||||
public E sync() {
|
public E sync() {
|
||||||
|
|
||||||
ResultSet resultSet = sessionOps.executeAsync(options(buildStatement()), showValues).getUninterruptibly();
|
ResultSet resultSet = sessionOps.executeAsync(options(buildStatement()), showValues).getUninterruptibly();
|
||||||
|
@ -84,4 +101,20 @@ public abstract class AbstractOperation<E, O extends AbstractOperation<E, O>> ex
|
||||||
return Scala.asFuture(async());
|
return Scala.asFuture(async());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public <A> Future<Fun.Tuple2<E, A>> future(A a) {
|
||||||
|
return Scala.asFuture(async(), a);
|
||||||
|
}
|
||||||
|
|
||||||
|
public <A, B> Future<Fun.Tuple3<E, A, B>> future(A a, B b) {
|
||||||
|
return Scala.asFuture(async(), a, b);
|
||||||
|
}
|
||||||
|
|
||||||
|
public <A, B, C> Future<Fun.Tuple4<E, A, B, C>> future(A a, B b, C c) {
|
||||||
|
return Scala.asFuture(async(), a, b, c);
|
||||||
|
}
|
||||||
|
|
||||||
|
public <A, B, C, D> Future<Fun.Tuple5<E, A, B, C, D>> future(A a, B b, C c, D d) {
|
||||||
|
return Scala.asFuture(async(), a, b, c, d);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,7 @@ import com.datastax.driver.core.querybuilder.BuiltStatement;
|
||||||
import com.google.common.util.concurrent.ListenableFuture;
|
import com.google.common.util.concurrent.ListenableFuture;
|
||||||
import com.noorq.casser.core.AbstractSessionOperations;
|
import com.noorq.casser.core.AbstractSessionOperations;
|
||||||
import com.noorq.casser.support.CasserException;
|
import com.noorq.casser.support.CasserException;
|
||||||
|
import com.noorq.casser.support.Fun;
|
||||||
import com.noorq.casser.support.Scala;
|
import com.noorq.casser.support.Scala;
|
||||||
|
|
||||||
public abstract class AbstractStatementOperation<E, O extends AbstractStatementOperation<E, O>> {
|
public abstract class AbstractStatementOperation<E, O extends AbstractStatementOperation<E, O>> {
|
||||||
|
@ -238,4 +239,20 @@ public abstract class AbstractStatementOperation<E, O extends AbstractStatementO
|
||||||
return Scala.asFuture(prepareStatementAsync());
|
return Scala.asFuture(prepareStatementAsync());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public <A> Future<Fun.Tuple2<PreparedStatement, A>> prepareStatementFuture(A a) {
|
||||||
|
return Scala.asFuture(prepareStatementAsync(), a);
|
||||||
|
}
|
||||||
|
|
||||||
|
public <A, B> Future<Fun.Tuple3<PreparedStatement, A, B>> prepareStatementFuture(A a, B b) {
|
||||||
|
return Scala.asFuture(prepareStatementAsync(), a, b);
|
||||||
|
}
|
||||||
|
|
||||||
|
public <A, B, C> Future<Fun.Tuple4<PreparedStatement, A, B, C>> prepareStatementFuture(A a, B b, C c) {
|
||||||
|
return Scala.asFuture(prepareStatementAsync(), a, b, c);
|
||||||
|
}
|
||||||
|
|
||||||
|
public <A, B, C, D> Future<Fun.Tuple5<PreparedStatement, A, B, C, D>> prepareStatementFuture(A a, B b, C c, D d) {
|
||||||
|
return Scala.asFuture(prepareStatementAsync(), a, b, c, d);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@ import com.google.common.base.Function;
|
||||||
import com.google.common.util.concurrent.Futures;
|
import com.google.common.util.concurrent.Futures;
|
||||||
import com.google.common.util.concurrent.ListenableFuture;
|
import com.google.common.util.concurrent.ListenableFuture;
|
||||||
import com.noorq.casser.core.AbstractSessionOperations;
|
import com.noorq.casser.core.AbstractSessionOperations;
|
||||||
|
import com.noorq.casser.support.Fun;
|
||||||
import com.noorq.casser.support.Scala;
|
import com.noorq.casser.support.Scala;
|
||||||
|
|
||||||
public abstract class AbstractStreamOperation<E, O extends AbstractStreamOperation<E, O>> extends AbstractStatementOperation<E, O> {
|
public abstract class AbstractStreamOperation<E, O extends AbstractStreamOperation<E, O>> extends AbstractStatementOperation<E, O> {
|
||||||
|
@ -59,6 +60,22 @@ public abstract class AbstractStreamOperation<E, O extends AbstractStreamOperati
|
||||||
return Scala.asFuture(prepareAsync());
|
return Scala.asFuture(prepareAsync());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public <A> Future<Fun.Tuple2<PreparedStreamOperation<E>, A>> prepareFuture(A a) {
|
||||||
|
return Scala.asFuture(prepareAsync(), a);
|
||||||
|
}
|
||||||
|
|
||||||
|
public <A, B> Future<Fun.Tuple3<PreparedStreamOperation<E>, A, B>> prepareFuture(A a, B b) {
|
||||||
|
return Scala.asFuture(prepareAsync(), a, b);
|
||||||
|
}
|
||||||
|
|
||||||
|
public <A, B, C> Future<Fun.Tuple4<PreparedStreamOperation<E>, A, B, C>> prepareFuture(A a, B b, C c) {
|
||||||
|
return Scala.asFuture(prepareAsync(), a, b, c);
|
||||||
|
}
|
||||||
|
|
||||||
|
public <A, B, C, D> Future<Fun.Tuple5<PreparedStreamOperation<E>, A, B, C, D>> prepareFuture(A a, B b, C c, D d) {
|
||||||
|
return Scala.asFuture(prepareAsync(), a, b, c, d);
|
||||||
|
}
|
||||||
|
|
||||||
public Stream<E> sync() {
|
public Stream<E> sync() {
|
||||||
|
|
||||||
ResultSet resultSet = sessionOps.executeAsync(options(buildStatement()), showValues).getUninterruptibly();
|
ResultSet resultSet = sessionOps.executeAsync(options(buildStatement()), showValues).getUninterruptibly();
|
||||||
|
@ -86,4 +103,20 @@ public abstract class AbstractStreamOperation<E, O extends AbstractStreamOperati
|
||||||
return Scala.asFuture(async());
|
return Scala.asFuture(async());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public <A> Future<Fun.Tuple2<Stream<E>, A>> future(A a) {
|
||||||
|
return Scala.asFuture(async(), a);
|
||||||
|
}
|
||||||
|
|
||||||
|
public <A, B> Future<Fun.Tuple3<Stream<E>, A, B>> future(A a, B b) {
|
||||||
|
return Scala.asFuture(async(), a, b);
|
||||||
|
}
|
||||||
|
|
||||||
|
public <A, B, C> Future<Fun.Tuple4<Stream<E>, A, B, C>> future(A a, B b, C c) {
|
||||||
|
return Scala.asFuture(async(), a, b, c);
|
||||||
|
}
|
||||||
|
|
||||||
|
public <A, B, C, D> Future<Fun.Tuple5<Stream<E>, A, B, C, D>> future(A a, B b, C c, D d) {
|
||||||
|
return Scala.asFuture(async(), a, b, c, d);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue