Interface QueryBuilder<T>

Type Parameters:
T - type of the DynamoDB entity
All Superinterfaces:
DetachedQuery<T>

public interface QueryBuilder<T> extends DetachedQuery<T>
Builder for DynamoDB queries.
  • Method Details

    • sort

      QueryBuilder<T> sort(com.agorapulse.micronaut.aws.dynamodb.builder.Builders.Sort sort)
      Sort the results by the range index
      Parameters:
      sort - the sort keyword
      Returns:
      self
    • consistent

      QueryBuilder<T> consistent(com.agorapulse.micronaut.aws.dynamodb.builder.Builders.Read read)
      Demand consistent reads.
      Parameters:
      read - the read keyword
      Returns:
      self
    • inconsistent

      QueryBuilder<T> inconsistent(com.agorapulse.micronaut.aws.dynamodb.builder.Builders.Read read)
      Demand inconsistent reads.
      Parameters:
      read - the read keyword
      Returns:
      self
    • index

      QueryBuilder<T> index(String name)
      Select the index on which this query will be executed.
      Parameters:
      name - the name of the index to be used
      Returns:
      self
    • hash

      QueryBuilder<T> hash(Object key)
      Sets the hash key value for the query. This parameter is required for every query.
      Parameters:
      key - the hash key of the query or an instance of the object with the hash key set
      Returns:
      self
    • range

      One or more range key conditions.
      Parameters:
      conditions - consumer to build the conditions
      Returns:
      self
    • range

      default QueryBuilder<T> range(@DelegatesTo(type="com.agorapulse.micronaut.aws.dynamodb.builder.RangeConditionCollector<T>",strategy=1) groovy.lang.Closure<RangeConditionCollector<T>> conditions)
      One or more range key conditions.
      Parameters:
      conditions - closure to build the conditions
      Returns:
      self
    • filter

      One or more range key filter conditions. These conditions are resolved on the result set before returning the values and therefore they don't require an existing index but they consume more resources as all the result set must be traversed.
      Parameters:
      conditions - consumer to build the conditions
      Returns:
      self
    • or

      default QueryBuilder<T> or(Consumer<RangeConditionCollector<T>> conditions)
      One or more range key filter conditions in disjunction.

      These conditions are resolved on the result set before returning the values and therefore they don't require an existing index but they consume more resources as all the result set must be traversed.

      Parameters:
      conditions - consumer to build the conditions
      Returns:
      self
    • and

      default QueryBuilder<T> and(Consumer<RangeConditionCollector<T>> conditions)
      One or more range key filter conditions in conjunction.

      These conditions are resolved on the result set before returning the values and therefore they don't require an existing index but they consume more resources as all the result set must be traversed.

      Parameters:
      conditions - consumer to build the conditions
      Returns:
      self
    • filter

      default QueryBuilder<T> filter(@DelegatesTo(type="com.agorapulse.micronaut.aws.dynamodb.builder.RangeConditionCollector<T>",strategy=1) groovy.lang.Closure<RangeConditionCollector<T>> conditions)
      One or more range key filter conditions. These conditions are resolved on the result set before returning the values and therefore they don't require an existing index but they consume more resources as all the result set must be traversed.
      Parameters:
      conditions - closure to build the conditions
      Returns:
      self
    • or

      default QueryBuilder<T> or(@DelegatesTo(type="com.agorapulse.micronaut.aws.dynamodb.builder.RangeConditionCollector<T>",strategy=1) groovy.lang.Closure<RangeConditionCollector<T>> conditions)
      One or more range key filter conditions in disjunction. These conditions are resolved on the result set before returning the values and therefore they don't require an existing index but they consume more resources as all the result set must be traversed.
      Parameters:
      conditions - closure to build the conditions
      Returns:
      self
    • and

      default QueryBuilder<T> and(@DelegatesTo(type="com.agorapulse.micronaut.aws.dynamodb.builder.RangeConditionCollector<T>",strategy=1) groovy.lang.Closure<RangeConditionCollector<T>> conditions)
      One or more range key filter conditions in conjunction. These conditions are resolved on the result set before returning the values and therefore they don't require an existing index but they consume more resources as all the result set must be traversed.
      Parameters:
      conditions - closure to build the conditions
      Returns:
      self
    • filter

      QueryBuilder<T> filter(com.amazonaws.services.dynamodbv2.model.ConditionalOperator or)
      Sets the conditional operator for the filter. Default is and
      Parameters:
      or - the conditional operator, usually or to switch to disjunction of filter conditions
      Returns:
      self
    • page

      QueryBuilder<T> page(int page)
      Sets the desired pagination of the queries. This only sets the optimal pagination of the queries and does not limit the number of items returned. Use io.reactivex.Flowable#take(long) to limit the number results returned from the query.
      Parameters:
      page - number of entities loaded by one query request (not a number of total entities returned)
      Returns:
      self
    • limit

      QueryBuilder<T> limit(int max)
      Sets the maximum number of items to be returned from the queries. This is a shortcut for calling io.reactivex.Flowable#take(long) on the result Flowable.
      Parameters:
      max - the maximum number of items returned
      Returns:
      self
    • offset

      QueryBuilder<T> offset(Object exclusiveStartKeyValue, Object exclusiveRangeStartKey)
      Sets the query offset by defining the exclusive start hash and range key (hash and range key of the last entity returned).
      Parameters:
      exclusiveStartKeyValue - exclusive start key hash value
      exclusiveRangeStartKey - exclusive start key range value
      Returns:
      self
    • offset

      default QueryBuilder<T> offset(Object exclusiveStartKeyValue)
      Sets the query offset by defining the exclusive start hash key (hash key of the last entity returned).
      Parameters:
      exclusiveStartKeyValue - exclusive start key hash value
      Returns:
      self
    • configure

      QueryBuilder<T> configure(Consumer<com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBQueryExpression<T>> configurer)
      Configures the native query expression. This method is an extension point which allows to configure properties which are not provides by this builder.
      Parameters:
      configurer - consumer to configure the native query expression
      Returns:
      self
    • configure

      default QueryBuilder<T> configure(@DelegatesTo(type="com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBQueryExpression<T>",strategy=1) groovy.lang.Closure<Object> configurer)
      Configures the native query expression. This method is an extension point which allows to configure properties which are not provides by this builder.
      Parameters:
      configurer - closure to configure the native query expression
      Returns:
      self
    • only

      QueryBuilder<T> only(Iterable<String> propertyPaths)
      Limits which properties of the returned entities will be populated.
      Parameters:
      propertyPaths - property paths to be populated in the returned entities
      Returns:
      self
    • only

      default QueryBuilder<T> only(String... propertyPaths)
      Limits which properties of the returned entities will be populated.
      Parameters:
      propertyPaths - property paths to be populated in the returned entities
      Returns:
      self
    • only

      default QueryBuilder<T> only(@DelegatesTo(type="T",strategy=3) groovy.lang.Closure<Object> collector)
      Limits which properties of the returned entities will be populated.
      Parameters:
      collector - closure to collect the property paths
      Returns:
      self