Interface QueryConditional
- All Known Implementing Classes:
BeginsWithConditional
,BetweenConditional
,EqualToConditional
,SingleKeyItemConditional
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
Modifier and TypeMethodDescriptionexpression
(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
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 Details
-
keyEqualTo
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
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
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
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
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
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
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
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
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
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
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
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
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
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
-