add prepared statements and counters
This commit is contained in:
parent
019dafbf79
commit
39a463e4a6
7 changed files with 52 additions and 0 deletions
|
@ -1,7 +1,9 @@
|
|||
package casser;
|
||||
|
||||
import casser.core.Casser;
|
||||
import casser.core.PreparedStreamStatement;
|
||||
import casser.core.Session;
|
||||
import casser.tuple.Tuple1;
|
||||
import casser.tuple.Tuple2;
|
||||
|
||||
public class Example {
|
||||
|
@ -35,6 +37,13 @@ public class Example {
|
|||
|
||||
session.delete().where(_user::getId, "==", 100L).async();
|
||||
|
||||
|
||||
PreparedStreamStatement<Tuple1<String>> ps = session.select(_user::getName).where(_user::getId, "==", null).prepare();
|
||||
|
||||
long cnt = ps.bind(100L).sync().count();
|
||||
|
||||
cnt = session.select(_user::getName).where(_user::getId, "==", 100L).count().sync();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
11
src/casser/core/PreparedStatement.java
Normal file
11
src/casser/core/PreparedStatement.java
Normal file
|
@ -0,0 +1,11 @@
|
|||
package casser.core;
|
||||
|
||||
import casser.operation.AbstractOperation;
|
||||
|
||||
public class PreparedStatement<E> {
|
||||
|
||||
public AbstractOperation<E> bind(Object... params) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
11
src/casser/core/PreparedStreamStatement.java
Normal file
11
src/casser/core/PreparedStreamStatement.java
Normal file
|
@ -0,0 +1,11 @@
|
|||
package casser.core;
|
||||
|
||||
import casser.operation.AbstractStreamOperation;
|
||||
|
||||
public class PreparedStreamStatement<E> {
|
||||
|
||||
public AbstractStreamOperation<E> bind(Object... params) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -2,8 +2,14 @@ package casser.operation;
|
|||
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import casser.core.PreparedStreamStatement;
|
||||
|
||||
public abstract class AbstractOperation<E> {
|
||||
|
||||
public PreparedStreamStatement<E> prepare() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public E sync() {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -3,8 +3,14 @@ package casser.operation;
|
|||
import java.util.concurrent.Future;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import casser.core.PreparedStreamStatement;
|
||||
|
||||
public abstract class AbstractStreamOperation<E> {
|
||||
|
||||
public PreparedStreamStatement<E> prepare() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Stream<E> sync() {
|
||||
return null;
|
||||
}
|
||||
|
|
5
src/casser/operation/CountOperation.java
Normal file
5
src/casser/operation/CountOperation.java
Normal file
|
@ -0,0 +1,5 @@
|
|||
package casser.operation;
|
||||
|
||||
public class CountOperation extends AbstractOperation<Long> {
|
||||
|
||||
}
|
|
@ -15,6 +15,10 @@ public class SelectOperation<E> extends AbstractStreamOperation<E> {
|
|||
return this;
|
||||
}
|
||||
|
||||
public CountOperation count() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public <R> SelectOperation<R> map(Function<E, R> fn) {
|
||||
return null;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue