public abstract class CQLBuilder
extends java.lang.Object
CQLBuilder
and more efficient, comparing to write Cassandra CQL in plain text.
cql()
or pair()
method must be called to release resources.
String cql = NE.insert("gui", "firstName", "lastName").into("account").cql();
// CQL: INSERT INTO account (gui, first_name, last_name) VALUES (:gui, :firstName, :lastName)
Modifier and Type | Class and Description |
---|---|
static class |
CQLBuilder.CP |
static class |
CQLBuilder.E
All the property/column names in collection/map/entity/condition will be converted to lower case with underscore.
|
static class |
CQLBuilder.E2
All the property/column names in collection/map/entity/condition will be converted to upper case with underscore.
|
static class |
CQLBuilder.E3
All the property/column names in collection/map/entity/condition will be kept without any change.
|
static class |
CQLBuilder.NE
All the property/column names in collection/map/entity/condition will be converted to lower case with underscore and the cql will be parameterized with named parameter with Hibernate/JPA format
:parameterName |
static class |
CQLBuilder.NE2
All the property/column names in collection/map/entity/condition will be converted to upper case with underscore and the cql will be parameterized with named parameter with Hibernate/JPA format
:parameterName |
static class |
CQLBuilder.NE3
All the property/column names in collection/map/entity/condition will be kept without any change and the cql will be parameterized with named parameter with Hibernate/JPA format
:parameterName |
static class |
CQLBuilder.RE
All the property/column names in collection/map/entity/condition will be converted to lower case with underscore and the cql will be parameterized with question mark.
|
static class |
CQLBuilder.RE2
All the property/column names in collection/map/entity/condition will be converted to upper case with underscore and the cql will be parameterized with question mark.
|
static class |
CQLBuilder.RE3
All the property/column names in collection/map/entity/condition will be kept without any change and the cql will be parameterized with question mark.
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
COUNT_ALL |
static java.lang.String |
DISTINCT |
Modifier and Type | Method and Description |
---|---|
<EX extends java.lang.Exception> |
accept(Try.Consumer<? super CQLBuilder.CP,EX> consumer) |
CQLBuilder |
allowFiltering() |
<T,EX extends java.lang.Exception> |
apply(Try.Function<? super CQLBuilder.CP,T,EX> func) |
java.lang.String |
cql()
This CQLBuilder will be closed after
cql() is called. |
CQLBuilder |
from(java.lang.Class<?> entityClass) |
CQLBuilder |
from(java.util.Collection<java.lang.String> tableNames) |
CQLBuilder |
from(java.util.Map<java.lang.String,java.lang.String> tableAliases) |
CQLBuilder |
from(java.lang.String... tableNames) |
CQLBuilder |
from(java.lang.String expr) |
CQLBuilder |
ifExists() |
CQLBuilder |
iff(Condition cond) |
CQLBuilder |
iff(java.lang.String expr) |
CQLBuilder |
ifNotExists() |
CQLBuilder |
into(java.lang.Class<?> entityClass) |
CQLBuilder |
into(java.lang.String tableName) |
CQLBuilder |
limit(int count) |
CQLBuilder |
orderBy(java.util.Collection<java.lang.String> columnNames) |
CQLBuilder |
orderBy(java.util.Collection<java.lang.String> columnNames,
com.landawn.abacus.util.SortDirection direction) |
CQLBuilder |
orderBy(java.util.Map<java.lang.String,com.landawn.abacus.util.SortDirection> orders) |
CQLBuilder |
orderBy(java.lang.String... columnNames) |
CQLBuilder |
orderBy(java.lang.String expr) |
CQLBuilder |
orderBy(java.lang.String columnName,
com.landawn.abacus.util.SortDirection direction) |
CQLBuilder.CP |
pair()
This CQLBuilder will be closed after
pair() is called. |
java.util.List<java.lang.Object> |
parameters() |
CQLBuilder |
set(java.lang.Class<?> entityClass) |
CQLBuilder |
set(java.lang.Class<?> entityClass,
java.util.Set<java.lang.String> excludedPropNames) |
CQLBuilder |
set(java.util.Collection<java.lang.String> columnNames) |
CQLBuilder |
set(java.util.Map<java.lang.String,java.lang.Object> props) |
CQLBuilder |
set(java.lang.Object entity)
Only the dirty properties will be set into the result CQL if the specified entity is a dirty marker entity.
|
CQLBuilder |
set(java.lang.Object entity,
java.util.Set<java.lang.String> excludedPropNames)
Only the dirty properties will be set into the result SQL if the specified entity is a dirty marker entity.
|
CQLBuilder |
set(java.lang.String... columnNames) |
CQLBuilder |
set(java.lang.String expr) |
java.lang.String |
toString() |
CQLBuilder |
usingTimestamp(java.util.Date timestamp) |
CQLBuilder |
usingTimestamp(long timestamp) |
CQLBuilder |
usingTimestamp(java.lang.String timestamp) |
CQLBuilder |
usingTTL(long timestamp) |
CQLBuilder |
usingTTL(java.lang.String timestamp) |
CQLBuilder |
where(Condition cond) |
CQLBuilder |
where(java.lang.String expr) |
public static final java.lang.String DISTINCT
public static final java.lang.String COUNT_ALL
public CQLBuilder into(java.lang.String tableName)
public CQLBuilder into(java.lang.Class<?> entityClass)
public CQLBuilder from(java.lang.String expr)
@SafeVarargs public final CQLBuilder from(java.lang.String... tableNames)
public CQLBuilder from(java.util.Collection<java.lang.String> tableNames)
public CQLBuilder from(java.util.Map<java.lang.String,java.lang.String> tableAliases)
public CQLBuilder from(java.lang.Class<?> entityClass)
public CQLBuilder where(java.lang.String expr)
public CQLBuilder where(Condition cond)
cond
- any literal written in Expression
condition won't be formalizedpublic CQLBuilder orderBy(java.lang.String expr)
@SafeVarargs public final CQLBuilder orderBy(java.lang.String... columnNames)
public CQLBuilder orderBy(java.lang.String columnName, com.landawn.abacus.util.SortDirection direction)
public CQLBuilder orderBy(java.util.Collection<java.lang.String> columnNames)
public CQLBuilder orderBy(java.util.Collection<java.lang.String> columnNames, com.landawn.abacus.util.SortDirection direction)
public CQLBuilder orderBy(java.util.Map<java.lang.String,com.landawn.abacus.util.SortDirection> orders)
public CQLBuilder limit(int count)
public CQLBuilder set(java.lang.String expr)
@SafeVarargs public final CQLBuilder set(java.lang.String... columnNames)
public CQLBuilder set(java.util.Collection<java.lang.String> columnNames)
public CQLBuilder set(java.util.Map<java.lang.String,java.lang.Object> props)
public CQLBuilder set(java.lang.Object entity)
entity
- public CQLBuilder set(java.lang.Object entity, java.util.Set<java.lang.String> excludedPropNames)
entity
- excludedPropNames
- public CQLBuilder set(java.lang.Class<?> entityClass)
public CQLBuilder set(java.lang.Class<?> entityClass, java.util.Set<java.lang.String> excludedPropNames)
public CQLBuilder usingTTL(long timestamp)
public CQLBuilder usingTTL(java.lang.String timestamp)
public CQLBuilder usingTimestamp(java.util.Date timestamp)
public CQLBuilder usingTimestamp(long timestamp)
public CQLBuilder usingTimestamp(java.lang.String timestamp)
public CQLBuilder iff(java.lang.String expr)
public CQLBuilder iff(Condition cond)
cond
- any literal written in Expression
condition won't be formalizedpublic CQLBuilder ifExists()
public CQLBuilder ifNotExists()
public CQLBuilder allowFiltering()
public java.lang.String cql()
cql()
is called.public java.util.List<java.lang.Object> parameters()
public CQLBuilder.CP pair()
pair()
is called.public <T,EX extends java.lang.Exception> T apply(Try.Function<? super CQLBuilder.CP,T,EX> func) throws EX extends java.lang.Exception
EX extends java.lang.Exception
public <EX extends java.lang.Exception> void accept(Try.Consumer<? super CQLBuilder.CP,EX> consumer) throws EX extends java.lang.Exception
EX extends java.lang.Exception
public java.lang.String toString()
toString
in class java.lang.Object