Interface QueryConditional
-
- All Known Implementing Classes:
BeginsWithConditional
,BetweenConditional
,EqualToConditional
,SingleKeyItemConditional
@ThreadSafe public interface QueryConditional
An interface for a literal conditional that can be used in an enhanced DynamoDB query. Contains convenient static methods that can be used to construct the most common conditional statements. Query conditionals are not linked to any specific table or schema and can be re-used in different contexts.Example:
QueryConditional sortValueGreaterThanFour = QueryConditional.sortGreaterThan(k -> k.partitionValue(10).sortValue(4));
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description Expression
expression(TableSchema<?> tableSchema, String indexName)
Generates a conditionalExpression
based on specific context that is supplied as arguments.static QueryConditional
keyEqualTo(Consumer<Key.Builder> keyConsumer)
Creates aQueryConditional
that matches when the key of an index is equal to a specific value.static QueryConditional
keyEqualTo(Key key)
Creates aQueryConditional
that matches when the key of an index is equal to a specific value.static QueryConditional
sortBeginsWith(Consumer<Key.Builder> keyConsumer)
Creates aQueryConditional
that matches when the key of an index begins with a specific value.static QueryConditional
sortBeginsWith(Key key)
Creates aQueryConditional
that matches when the key of an index begins with a specific value.static QueryConditional
sortBetween(Consumer<Key.Builder> keyFromConsumer, Consumer<Key.Builder> keyToConsumer)
Creates aQueryConditional
that matches when the key of an index is between two specific values.static QueryConditional
sortBetween(Key keyFrom, Key keyTo)
Creates aQueryConditional
that matches when the key of an index is between two specific values.static QueryConditional
sortGreaterThan(Consumer<Key.Builder> keyConsumer)
Creates aQueryConditional
that matches when the key of an index is greater than a specific value.static QueryConditional
sortGreaterThan(Key key)
Creates aQueryConditional
that matches when the key of an index is greater than a specific value.static QueryConditional
sortGreaterThanOrEqualTo(Consumer<Key.Builder> keyConsumer)
Creates aQueryConditional
that matches when the key of an index is greater than or equal to a specific value.static QueryConditional
sortGreaterThanOrEqualTo(Key key)
Creates aQueryConditional
that matches when the key of an index is greater than or equal to a specific value.static QueryConditional
sortLessThan(Consumer<Key.Builder> keyConsumer)
Creates aQueryConditional
that matches when the key of an index is less than a specific value.static QueryConditional
sortLessThan(Key key)
Creates aQueryConditional
that matches when the key of an index is less than a specific value.static QueryConditional
sortLessThanOrEqualTo(Consumer<Key.Builder> keyConsumer)
Creates aQueryConditional
that matches when the key of an index is less than or equal to a specific value.static QueryConditional
sortLessThanOrEqualTo(Key key)
Creates aQueryConditional
that matches when the key of an index is less than or equal to a specific value.
-
-
-
Method Detail
-
keyEqualTo
static QueryConditional keyEqualTo(Key key)
Creates aQueryConditional
that matches when the key of an index is equal to a specific value.- Parameters:
key
- the literal key used to compare the value of the index against
-
keyEqualTo
static QueryConditional keyEqualTo(Consumer<Key.Builder> keyConsumer)
Creates aQueryConditional
that matches when the key of an index is equal to a specific value.- Parameters:
keyConsumer
- 'builder consumer' for the literal key used to compare the value of the index against
-
sortGreaterThan
static QueryConditional sortGreaterThan(Key key)
Creates aQueryConditional
that matches when the key of an index is greater than a specific value.- Parameters:
key
- the literal key used to compare the value of the index against
-
sortGreaterThan
static QueryConditional sortGreaterThan(Consumer<Key.Builder> keyConsumer)
Creates aQueryConditional
that matches when the key of an index is greater than a specific value.- Parameters:
keyConsumer
- 'builder consumer' for the literal key used to compare the value of the index against
-
sortGreaterThanOrEqualTo
static QueryConditional sortGreaterThanOrEqualTo(Key key)
Creates aQueryConditional
that matches when the key of an index is greater than or equal to a specific value.- Parameters:
key
- the literal key used to compare the value of the index against
-
sortGreaterThanOrEqualTo
static QueryConditional sortGreaterThanOrEqualTo(Consumer<Key.Builder> keyConsumer)
Creates aQueryConditional
that matches when the key of an index is greater than or equal to a specific value.- Parameters:
keyConsumer
- 'builder consumer' for the literal key used to compare the value of the index against
-
sortLessThan
static QueryConditional sortLessThan(Key key)
Creates aQueryConditional
that matches when the key of an index is less than a specific value.- Parameters:
key
- the literal key used to compare the value of the index against
-
sortLessThan
static QueryConditional sortLessThan(Consumer<Key.Builder> keyConsumer)
Creates aQueryConditional
that matches when the key of an index is less than a specific value.- Parameters:
keyConsumer
- 'builder consumer' for the literal key used to compare the value of the index against
-
sortLessThanOrEqualTo
static QueryConditional sortLessThanOrEqualTo(Key key)
Creates aQueryConditional
that matches when the key of an index is less than or equal to a specific value.- Parameters:
key
- the literal key used to compare the value of the index against
-
sortLessThanOrEqualTo
static QueryConditional sortLessThanOrEqualTo(Consumer<Key.Builder> keyConsumer)
Creates aQueryConditional
that matches when the key of an index is less than or equal to a specific value.- Parameters:
keyConsumer
- 'builder consumer' for the literal key used to compare the value of the index against
-
sortBetween
static QueryConditional sortBetween(Key keyFrom, Key keyTo)
Creates aQueryConditional
that matches when the key of an index is between two specific values.- Parameters:
keyFrom
- the literal key used to compare the start of the range to compare the value of the index againstkeyTo
- the literal key used to compare the end of the range to compare the value of the index against
-
sortBetween
static QueryConditional sortBetween(Consumer<Key.Builder> keyFromConsumer, Consumer<Key.Builder> keyToConsumer)
Creates aQueryConditional
that matches when the key of an index is between two specific values.- Parameters:
keyFromConsumer
- 'builder consumer' for the literal key used to compare the start of the range to compare the value of the index againstkeyToConsumer
- 'builder consumer' for the literal key used to compare the end of the range to compare the value of the index against
-
sortBeginsWith
static QueryConditional sortBeginsWith(Key key)
Creates aQueryConditional
that matches when the key of an index begins with a specific value.- Parameters:
key
- the literal key used to compare the start of the value of the index against
-
sortBeginsWith
static QueryConditional sortBeginsWith(Consumer<Key.Builder> keyConsumer)
Creates aQueryConditional
that matches when the key of an index begins with a specific value.- Parameters:
keyConsumer
- 'builder consumer' the literal key used to compare the start of the value of the index against
-
expression
Expression expression(TableSchema<?> tableSchema, String indexName)
Generates a conditionalExpression
based on specific context that is supplied as arguments.- Parameters:
tableSchema
- ATableSchema
that this expression will be used withindexName
- The specific index name of the index this expression will be used with- Returns:
- A specific
Expression
that can be used as part of a query request
-
-