public interface Assignment extends CqlSnippet
Modifier and Type | Method and Description |
---|---|
static Assignment |
append(CqlIdentifier columnId,
Term suffix)
Appends to a collection column, as in
SET l=l+? . |
static Assignment |
append(String columnName,
Term suffix)
Shortcut for
append(CqlIdentifier.fromCql(columnName),
suffix) . |
static Assignment |
appendListElement(CqlIdentifier columnId,
Term suffix)
Appends a single element to a list column, as in
SET l=l+[?] . |
static Assignment |
appendListElement(String columnName,
Term suffix)
|
static Assignment |
appendMapEntry(CqlIdentifier columnId,
Term key,
Term value)
Appends a single entry to a map column, as in
SET m=m+{?:?} . |
static Assignment |
appendMapEntry(String columnName,
Term key,
Term value)
|
static Assignment |
appendSetElement(CqlIdentifier columnId,
Term suffix)
Appends a single element to a set column, as in
SET s=s+{?} . |
static Assignment |
appendSetElement(String columnName,
Term suffix)
|
static Assignment |
decrement(CqlIdentifier columnId)
Decrements a counter by 1, as in
SET c=c-1 . |
static Assignment |
decrement(CqlIdentifier columnId,
Term amount)
Decrements a counter, as in
SET c=c-? . |
static Assignment |
decrement(String columnName)
Shortcut for
CqlIdentifier.fromCql(columnName) . |
static Assignment |
decrement(String columnName,
Term amount)
Shortcut for
decrement(CqlIdentifier.fromCql(columnName), amount) |
static Assignment |
increment(CqlIdentifier columnId)
Increments a counter by 1, as in
SET c=c+1 . |
static Assignment |
increment(CqlIdentifier columnId,
Term amount)
Increments a counter, as in
SET c=c+? . |
static Assignment |
increment(String columnName)
Shortcut for
CqlIdentifier.fromCql(columnName) . |
static Assignment |
increment(String columnName,
Term amount)
Shortcut for
increment(CqlIdentifier.fromCql(columnName), amount) |
boolean |
isIdempotent()
Whether this assignment is idempotent.
|
static Assignment |
prepend(CqlIdentifier columnId,
Term prefix)
Prepends to a collection column, as in
SET l=[1,2,3]+l . |
static Assignment |
prepend(String columnName,
Term prefix)
Shortcut for
prepend(CqlIdentifier.fromCql(columnName),
prefix) . |
static Assignment |
prependListElement(CqlIdentifier columnId,
Term suffix)
Prepends a single element to a list column, as in
SET l=[?]+l . |
static Assignment |
prependListElement(String columnName,
Term suffix)
|
static Assignment |
prependMapEntry(CqlIdentifier columnId,
Term key,
Term value)
Prepends a single entry to a map column, as in
SET m={?:?}+m . |
static Assignment |
prependMapEntry(String columnName,
Term key,
Term value)
|
static Assignment |
prependSetElement(CqlIdentifier columnId,
Term suffix)
Prepends a single element to a set column, as in
SET s={?}+s . |
static Assignment |
prependSetElement(String columnName,
Term suffix)
|
static Assignment |
remove(CqlIdentifier columnId,
Term collectionToRemove)
Removes elements from a collection, as in
SET l=l-[1,2,3] . |
static Assignment |
remove(String columnName,
Term collectionToRemove)
|
static Assignment |
removeListElement(CqlIdentifier columnId,
Term suffix)
Removes a single element from a list column, as in
SET l=l-[?] . |
static Assignment |
removeListElement(String columnName,
Term suffix)
|
static Assignment |
removeMapEntry(CqlIdentifier columnId,
Term key,
Term value)
Removes a single entry from a map column, as in
SET m=m-{?:?} . |
static Assignment |
removeMapEntry(String columnName,
Term key,
Term value)
|
static Assignment |
removeSetElement(CqlIdentifier columnId,
Term suffix)
Removes a single element from a set column, as in
SET s=s-{?} . |
static Assignment |
removeSetElement(String columnName,
Term suffix)
|
static Assignment |
setColumn(CqlIdentifier columnId,
Term value)
Assigns a value to a column, as in
SET c=? . |
static Assignment |
setColumn(String columnName,
Term value)
Shortcut for
setColumn(CqlIdentifier.fromCql(columnName), value) . |
static Assignment |
setField(CqlIdentifier columnId,
CqlIdentifier fieldId,
Term value)
Assigns a value to a field of a UDT, as in
SET address.zip=? . |
static Assignment |
setField(String columnName,
String fieldName,
Term value)
|
static Assignment |
setListValue(CqlIdentifier columnId,
Term index,
Term value)
Assigns a value to an index in a list column, as in
SET list[?]=? . |
static Assignment |
setListValue(String columnName,
Term index,
Term value)
|
static Assignment |
setMapValue(CqlIdentifier columnId,
Term key,
Term value)
Assigns a value to an entry in a map column, as in
SET map[?]=? . |
static Assignment |
setMapValue(String columnName,
Term key,
Term value)
|
appendTo
@NonNull static Assignment setColumn(@NonNull CqlIdentifier columnId, @NonNull Term value)
SET c=?
.@NonNull static Assignment setColumn(@NonNull String columnName, @NonNull Term value)
setColumn(CqlIdentifier.fromCql(columnName), value)
.@NonNull static Assignment setField(@NonNull CqlIdentifier columnId, @NonNull CqlIdentifier fieldId, @NonNull Term value)
SET address.zip=?
.@NonNull static Assignment setField(@NonNull String columnName, @NonNull String fieldName, @NonNull Term value)
@NonNull static Assignment setMapValue(@NonNull CqlIdentifier columnId, @NonNull Term key, @NonNull Term value)
SET map[?]=?
.@NonNull static Assignment setMapValue(@NonNull String columnName, @NonNull Term key, @NonNull Term value)
@NonNull static Assignment setListValue(@NonNull CqlIdentifier columnId, @NonNull Term index, @NonNull Term value)
SET list[?]=?
.@NonNull static Assignment setListValue(@NonNull String columnName, @NonNull Term index, @NonNull Term value)
@NonNull static Assignment increment(@NonNull CqlIdentifier columnId, @NonNull Term amount)
SET c=c+?
.@NonNull static Assignment increment(@NonNull String columnName, @NonNull Term amount)
increment(CqlIdentifier.fromCql(columnName), amount)
@NonNull static Assignment increment(@NonNull CqlIdentifier columnId)
SET c=c+1
.@NonNull static Assignment increment(@NonNull String columnName)
CqlIdentifier.fromCql(columnName)
.@NonNull static Assignment decrement(@NonNull CqlIdentifier columnId, @NonNull Term amount)
SET c=c-?
.@NonNull static Assignment decrement(@NonNull String columnName, @NonNull Term amount)
decrement(CqlIdentifier.fromCql(columnName), amount)
@NonNull static Assignment decrement(@NonNull CqlIdentifier columnId)
SET c=c-1
.@NonNull static Assignment decrement(@NonNull String columnName)
CqlIdentifier.fromCql(columnName)
.@NonNull static Assignment append(@NonNull CqlIdentifier columnId, @NonNull Term suffix)
SET l=l+?
.
The term must be a collection of the same type as the column.
@NonNull static Assignment append(@NonNull String columnName, @NonNull Term suffix)
append(CqlIdentifier.fromCql(columnName),
suffix)
.@NonNull static Assignment appendListElement(@NonNull CqlIdentifier columnId, @NonNull Term suffix)
SET l=l+[?]
.
The term must be of the same type as the column's elements.
@NonNull static Assignment appendListElement(@NonNull String columnName, @NonNull Term suffix)
@NonNull static Assignment appendSetElement(@NonNull CqlIdentifier columnId, @NonNull Term suffix)
SET s=s+{?}
.
The term must be of the same type as the column's elements.
@NonNull static Assignment appendSetElement(@NonNull String columnName, @NonNull Term suffix)
@NonNull static Assignment appendMapEntry(@NonNull CqlIdentifier columnId, @NonNull Term key, @NonNull Term value)
SET m=m+{?:?}
.
The terms must be of the same type as the column's keys and values respectively.
@NonNull static Assignment appendMapEntry(@NonNull String columnName, @NonNull Term key, @NonNull Term value)
@NonNull static Assignment prepend(@NonNull CqlIdentifier columnId, @NonNull Term prefix)
SET l=[1,2,3]+l
.
The term must be a collection of the same type as the column.
@NonNull static Assignment prepend(@NonNull String columnName, @NonNull Term prefix)
prepend(CqlIdentifier.fromCql(columnName),
prefix)
.@NonNull static Assignment prependListElement(@NonNull CqlIdentifier columnId, @NonNull Term suffix)
SET l=[?]+l
.
The term must be of the same type as the column's elements.
@NonNull static Assignment prependListElement(@NonNull String columnName, @NonNull Term suffix)
@NonNull static Assignment prependSetElement(@NonNull CqlIdentifier columnId, @NonNull Term suffix)
SET s={?}+s
.
The term must be of the same type as the column's elements.
@NonNull static Assignment prependSetElement(@NonNull String columnName, @NonNull Term suffix)
@NonNull static Assignment prependMapEntry(@NonNull CqlIdentifier columnId, @NonNull Term key, @NonNull Term value)
SET m={?:?}+m
.
The terms must be of the same type as the column's keys and values respectively.
@NonNull static Assignment prependMapEntry(@NonNull String columnName, @NonNull Term key, @NonNull Term value)
@NonNull static Assignment remove(@NonNull CqlIdentifier columnId, @NonNull Term collectionToRemove)
SET l=l-[1,2,3]
.
The term must be a collection of the same type as the column.
DO NOT USE THIS TO DECREMENT COUNTERS. Use the dedicated decrement(CqlIdentifier, Term)
methods instead. While the operator is technically the same,
and it would be possible to generate an expression such as counter-=1
with this method,
a collection removal is idempotent while a counter decrement isn't.
@NonNull static Assignment remove(@NonNull String columnName, @NonNull Term collectionToRemove)
@NonNull static Assignment removeListElement(@NonNull CqlIdentifier columnId, @NonNull Term suffix)
SET l=l-[?]
.
The term must be of the same type as the column's elements.
@NonNull static Assignment removeListElement(@NonNull String columnName, @NonNull Term suffix)
@NonNull static Assignment removeSetElement(@NonNull CqlIdentifier columnId, @NonNull Term suffix)
SET s=s-{?}
.
The term must be of the same type as the column's elements.
@NonNull static Assignment removeSetElement(@NonNull String columnName, @NonNull Term suffix)
@NonNull static Assignment removeMapEntry(@NonNull CqlIdentifier columnId, @NonNull Term key, @NonNull Term value)
SET m=m-{?:?}
.
The terms must be of the same type as the column's keys and values respectively.
@NonNull static Assignment removeMapEntry(@NonNull String columnName, @NonNull Term key, @NonNull Term value)
boolean isIdempotent()
That is, whether it always sets its target column to the same value when used multiple
times. For example, UPDATE ... SET c=1
is idempotent, SET l=l+[1]
isn't.
This is used internally by the query builder to compute the Request.isIdempotent()
flag on the UPDATE statements generated by BuildableQuery.build()
. If an assignment is
ambiguous (for example a raw snippet or a call to a user function in the right operands), the
builder is pessimistic and assumes the term is not idempotent.
Copyright © 2017–2022. All rights reserved.