refactor prepared statements
This commit is contained in:
parent
726f9d84cc
commit
a43e28ba06
6 changed files with 16 additions and 29 deletions
|
@ -1,7 +1,7 @@
|
|||
package casser;
|
||||
|
||||
import casser.core.Casser;
|
||||
import casser.core.PreparedStreamStatement;
|
||||
import casser.core.Prepared;
|
||||
import casser.core.Session;
|
||||
import casser.operation.SelectOperation;
|
||||
import casser.tuple.Tuple1;
|
||||
|
@ -38,8 +38,7 @@ public class Example {
|
|||
|
||||
session.delete().where(_user::getId, "==", 100L).async();
|
||||
|
||||
|
||||
PreparedStreamStatement<Tuple1<String>, SelectOperation<Tuple1<String>>> ps = session.select(_user::getName).where(_user::getId, "==", null).prepare();
|
||||
Prepared<SelectOperation<Tuple1<String>>> ps = session.select(_user::getName).where(_user::getId, "==", null).prepare();
|
||||
|
||||
long cnt = ps.bind(100L).sync().count();
|
||||
|
||||
|
|
10
src/casser/core/Prepared.java
Normal file
10
src/casser/core/Prepared.java
Normal file
|
@ -0,0 +1,10 @@
|
|||
package casser.core;
|
||||
|
||||
|
||||
public class Prepared<O> {
|
||||
|
||||
public O bind(Object... params) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
package casser.core;
|
||||
|
||||
import casser.operation.AbstractOperation;
|
||||
|
||||
public class PreparedStatement<E, O extends AbstractOperation<E, O>> {
|
||||
|
||||
public AbstractOperation<E, O> bind(Object... params) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
package casser.core;
|
||||
|
||||
import casser.operation.AbstractStreamOperation;
|
||||
|
||||
public class PreparedStreamStatement<E, O extends AbstractStreamOperation<E, O>> {
|
||||
|
||||
public AbstractStreamOperation<E, O> bind(Object... params) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -2,11 +2,11 @@ package casser.operation;
|
|||
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import casser.core.PreparedStatement;
|
||||
import casser.core.Prepared;
|
||||
|
||||
public abstract class AbstractOperation<E, O extends AbstractOperation<E, O>> {
|
||||
|
||||
public PreparedStatement<E, O> prepare() {
|
||||
public Prepared<O> prepare() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -3,11 +3,11 @@ package casser.operation;
|
|||
import java.util.concurrent.Future;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import casser.core.PreparedStreamStatement;
|
||||
import casser.core.Prepared;
|
||||
|
||||
public abstract class AbstractStreamOperation<E, O extends AbstractStreamOperation<E, O>> {
|
||||
|
||||
public PreparedStreamStatement<E, O> prepare() {
|
||||
public Prepared<O> prepare() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue