public interface Condition extends CqlSnippet
ConditionalStatement
.
To build instances of this type, use the factory methods, such as column
, field(String, String)
field}, etc.
They are used as arguments to the ConditionalStatement.if_(Iterable)
method, for
example:
deleteFrom("foo").whereColumn("k").isEqualTo(bindMarker())
.if_(Condition.column("v").isEqualTo(literal(1)))
// DELETE FROM foo WHERE k=? IF v=1
There are also shortcuts in the fluent API when you build a statement, for example:
deleteFrom("foo").whereColumn("k").isEqualTo(bindMarker())
.ifColumn("v").isEqualTo(literal(1))
// DELETE FROM foo WHERE k=? IF v=1
Modifier and Type | Method and Description |
---|---|
static ConditionBuilder<Condition> |
column(CqlIdentifier columnId)
Builds a condition on a column for a conditional statement, as in {@code DELETE...
|
static ConditionBuilder<Condition> |
column(String columnName)
Shortcut for
column(CqlIdentifier.fromCql(columnName)) . |
static ConditionBuilder<Condition> |
element(CqlIdentifier columnId,
Term index)
Builds a condition on an element in a collection column for a conditional statement, as in
{@code DELETE...
|
static ConditionBuilder<Condition> |
element(String columnName,
Term index)
Shortcut for
element(CqlIdentifier.fromCql(columnName),
index) . |
static ConditionBuilder<Condition> |
field(CqlIdentifier columnId,
CqlIdentifier fieldId)
Builds a condition on a field in a UDT column for a conditional statement, as in {@code
DELETE...
|
static ConditionBuilder<Condition> |
field(String columnName,
String fieldName)
|
appendTo
@NonNull static ConditionBuilder<Condition> column(@NonNull CqlIdentifier columnId)
DELETE... IF k=1
.@NonNull static ConditionBuilder<Condition> column(@NonNull String columnName)
column(CqlIdentifier.fromCql(columnName))
.@NonNull static ConditionBuilder<Condition> field(@NonNull CqlIdentifier columnId, @NonNull CqlIdentifier fieldId)
DELETE... IF address.street='test'
.@NonNull static ConditionBuilder<Condition> field(@NonNull String columnName, @NonNull String fieldName)
@NonNull static ConditionBuilder<Condition> element(@NonNull CqlIdentifier columnId, @NonNull Term index)
DELETE... IF m[0]=1
.@NonNull static ConditionBuilder<Condition> element(@NonNull String columnName, @NonNull Term index)
element(CqlIdentifier.fromCql(columnName),
index)
.Copyright © 2017–2019. All rights reserved.