Class StructuredQuery

java.lang.Object
com.google.protobuf.AbstractMessageLite
com.google.protobuf.AbstractMessage
com.google.protobuf.GeneratedMessageV3
com.google.firestore.v1.StructuredQuery
All Implemented Interfaces:
StructuredQueryOrBuilder, com.google.protobuf.Message, com.google.protobuf.MessageLite, com.google.protobuf.MessageLiteOrBuilder, com.google.protobuf.MessageOrBuilder, Serializable

public final class StructuredQuery extends com.google.protobuf.GeneratedMessageV3 implements StructuredQueryOrBuilder
 A Firestore query.

 The query stages are executed in the following order:
 1. from
 2. where
 3. select
 4. order_by + start_at + end_at
 5. offset
 6. limit
 
Protobuf type google.firestore.v1.StructuredQuery
See Also:
  • Field Details

  • Method Details

    • newInstance

      protected Object newInstance(com.google.protobuf.GeneratedMessageV3.UnusedPrivateParameter unused)
      Overrides:
      newInstance in class com.google.protobuf.GeneratedMessageV3
    • getDescriptor

      public static final com.google.protobuf.Descriptors.Descriptor getDescriptor()
    • internalGetFieldAccessorTable

      protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
      Specified by:
      internalGetFieldAccessorTable in class com.google.protobuf.GeneratedMessageV3
    • hasSelect

      public boolean hasSelect()
       Optional sub-set of the fields to return.
      
       This acts as a [DocumentMask][google.firestore.v1.DocumentMask] over the
       documents returned from a query. When not set, assumes that the caller
       wants all fields returned.
       
      .google.firestore.v1.StructuredQuery.Projection select = 1;
      Specified by:
      hasSelect in interface StructuredQueryOrBuilder
      Returns:
      Whether the select field is set.
    • getSelect

      public StructuredQuery.Projection getSelect()
       Optional sub-set of the fields to return.
      
       This acts as a [DocumentMask][google.firestore.v1.DocumentMask] over the
       documents returned from a query. When not set, assumes that the caller
       wants all fields returned.
       
      .google.firestore.v1.StructuredQuery.Projection select = 1;
      Specified by:
      getSelect in interface StructuredQueryOrBuilder
      Returns:
      The select.
    • getSelectOrBuilder

      public StructuredQuery.ProjectionOrBuilder getSelectOrBuilder()
       Optional sub-set of the fields to return.
      
       This acts as a [DocumentMask][google.firestore.v1.DocumentMask] over the
       documents returned from a query. When not set, assumes that the caller
       wants all fields returned.
       
      .google.firestore.v1.StructuredQuery.Projection select = 1;
      Specified by:
      getSelectOrBuilder in interface StructuredQueryOrBuilder
    • getFromList

       The collections to query.
       
      repeated .google.firestore.v1.StructuredQuery.CollectionSelector from = 2;
      Specified by:
      getFromList in interface StructuredQueryOrBuilder
    • getFromOrBuilderList

      public List<? extends StructuredQuery.CollectionSelectorOrBuilder> getFromOrBuilderList()
       The collections to query.
       
      repeated .google.firestore.v1.StructuredQuery.CollectionSelector from = 2;
      Specified by:
      getFromOrBuilderList in interface StructuredQueryOrBuilder
    • getFromCount

      public int getFromCount()
       The collections to query.
       
      repeated .google.firestore.v1.StructuredQuery.CollectionSelector from = 2;
      Specified by:
      getFromCount in interface StructuredQueryOrBuilder
    • getFrom

      public StructuredQuery.CollectionSelector getFrom(int index)
       The collections to query.
       
      repeated .google.firestore.v1.StructuredQuery.CollectionSelector from = 2;
      Specified by:
      getFrom in interface StructuredQueryOrBuilder
    • getFromOrBuilder

      public StructuredQuery.CollectionSelectorOrBuilder getFromOrBuilder(int index)
       The collections to query.
       
      repeated .google.firestore.v1.StructuredQuery.CollectionSelector from = 2;
      Specified by:
      getFromOrBuilder in interface StructuredQueryOrBuilder
    • hasWhere

      public boolean hasWhere()
       The filter to apply.
       
      .google.firestore.v1.StructuredQuery.Filter where = 3;
      Specified by:
      hasWhere in interface StructuredQueryOrBuilder
      Returns:
      Whether the where field is set.
    • getWhere

      public StructuredQuery.Filter getWhere()
       The filter to apply.
       
      .google.firestore.v1.StructuredQuery.Filter where = 3;
      Specified by:
      getWhere in interface StructuredQueryOrBuilder
      Returns:
      The where.
    • getWhereOrBuilder

      public StructuredQuery.FilterOrBuilder getWhereOrBuilder()
       The filter to apply.
       
      .google.firestore.v1.StructuredQuery.Filter where = 3;
      Specified by:
      getWhereOrBuilder in interface StructuredQueryOrBuilder
    • getOrderByList

      public List<StructuredQuery.Order> getOrderByList()
       The order to apply to the query results.
      
       Firestore allows callers to provide a full ordering, a partial ordering, or
       no ordering at all. In all cases, Firestore guarantees a stable ordering
       through the following rules:
      
        * The `order_by` is required to reference all fields used with an
          inequality filter.
        * All fields that are required to be in the `order_by` but are not already
          present are appended in lexicographical ordering of the field name.
        * If an order on `__name__` is not specified, it is appended by default.
      
       Fields are appended with the same sort direction as the last order
       specified, or 'ASCENDING' if no order was specified. For example:
      
        * `ORDER BY a` becomes `ORDER BY a ASC, __name__ ASC`
        * `ORDER BY a DESC` becomes `ORDER BY a DESC, __name__ DESC`
        * `WHERE a > 1` becomes `WHERE a > 1 ORDER BY a ASC, __name__ ASC`
        * `WHERE __name__ > ... AND a > 1` becomes
           `WHERE __name__ > ... AND a > 1 ORDER BY a ASC, __name__ ASC`
       
      repeated .google.firestore.v1.StructuredQuery.Order order_by = 4;
      Specified by:
      getOrderByList in interface StructuredQueryOrBuilder
    • getOrderByOrBuilderList

      public List<? extends StructuredQuery.OrderOrBuilder> getOrderByOrBuilderList()
       The order to apply to the query results.
      
       Firestore allows callers to provide a full ordering, a partial ordering, or
       no ordering at all. In all cases, Firestore guarantees a stable ordering
       through the following rules:
      
        * The `order_by` is required to reference all fields used with an
          inequality filter.
        * All fields that are required to be in the `order_by` but are not already
          present are appended in lexicographical ordering of the field name.
        * If an order on `__name__` is not specified, it is appended by default.
      
       Fields are appended with the same sort direction as the last order
       specified, or 'ASCENDING' if no order was specified. For example:
      
        * `ORDER BY a` becomes `ORDER BY a ASC, __name__ ASC`
        * `ORDER BY a DESC` becomes `ORDER BY a DESC, __name__ DESC`
        * `WHERE a > 1` becomes `WHERE a > 1 ORDER BY a ASC, __name__ ASC`
        * `WHERE __name__ > ... AND a > 1` becomes
           `WHERE __name__ > ... AND a > 1 ORDER BY a ASC, __name__ ASC`
       
      repeated .google.firestore.v1.StructuredQuery.Order order_by = 4;
      Specified by:
      getOrderByOrBuilderList in interface StructuredQueryOrBuilder
    • getOrderByCount

      public int getOrderByCount()
       The order to apply to the query results.
      
       Firestore allows callers to provide a full ordering, a partial ordering, or
       no ordering at all. In all cases, Firestore guarantees a stable ordering
       through the following rules:
      
        * The `order_by` is required to reference all fields used with an
          inequality filter.
        * All fields that are required to be in the `order_by` but are not already
          present are appended in lexicographical ordering of the field name.
        * If an order on `__name__` is not specified, it is appended by default.
      
       Fields are appended with the same sort direction as the last order
       specified, or 'ASCENDING' if no order was specified. For example:
      
        * `ORDER BY a` becomes `ORDER BY a ASC, __name__ ASC`
        * `ORDER BY a DESC` becomes `ORDER BY a DESC, __name__ DESC`
        * `WHERE a > 1` becomes `WHERE a > 1 ORDER BY a ASC, __name__ ASC`
        * `WHERE __name__ > ... AND a > 1` becomes
           `WHERE __name__ > ... AND a > 1 ORDER BY a ASC, __name__ ASC`
       
      repeated .google.firestore.v1.StructuredQuery.Order order_by = 4;
      Specified by:
      getOrderByCount in interface StructuredQueryOrBuilder
    • getOrderBy

      public StructuredQuery.Order getOrderBy(int index)
       The order to apply to the query results.
      
       Firestore allows callers to provide a full ordering, a partial ordering, or
       no ordering at all. In all cases, Firestore guarantees a stable ordering
       through the following rules:
      
        * The `order_by` is required to reference all fields used with an
          inequality filter.
        * All fields that are required to be in the `order_by` but are not already
          present are appended in lexicographical ordering of the field name.
        * If an order on `__name__` is not specified, it is appended by default.
      
       Fields are appended with the same sort direction as the last order
       specified, or 'ASCENDING' if no order was specified. For example:
      
        * `ORDER BY a` becomes `ORDER BY a ASC, __name__ ASC`
        * `ORDER BY a DESC` becomes `ORDER BY a DESC, __name__ DESC`
        * `WHERE a > 1` becomes `WHERE a > 1 ORDER BY a ASC, __name__ ASC`
        * `WHERE __name__ > ... AND a > 1` becomes
           `WHERE __name__ > ... AND a > 1 ORDER BY a ASC, __name__ ASC`
       
      repeated .google.firestore.v1.StructuredQuery.Order order_by = 4;
      Specified by:
      getOrderBy in interface StructuredQueryOrBuilder
    • getOrderByOrBuilder

      public StructuredQuery.OrderOrBuilder getOrderByOrBuilder(int index)
       The order to apply to the query results.
      
       Firestore allows callers to provide a full ordering, a partial ordering, or
       no ordering at all. In all cases, Firestore guarantees a stable ordering
       through the following rules:
      
        * The `order_by` is required to reference all fields used with an
          inequality filter.
        * All fields that are required to be in the `order_by` but are not already
          present are appended in lexicographical ordering of the field name.
        * If an order on `__name__` is not specified, it is appended by default.
      
       Fields are appended with the same sort direction as the last order
       specified, or 'ASCENDING' if no order was specified. For example:
      
        * `ORDER BY a` becomes `ORDER BY a ASC, __name__ ASC`
        * `ORDER BY a DESC` becomes `ORDER BY a DESC, __name__ DESC`
        * `WHERE a > 1` becomes `WHERE a > 1 ORDER BY a ASC, __name__ ASC`
        * `WHERE __name__ > ... AND a > 1` becomes
           `WHERE __name__ > ... AND a > 1 ORDER BY a ASC, __name__ ASC`
       
      repeated .google.firestore.v1.StructuredQuery.Order order_by = 4;
      Specified by:
      getOrderByOrBuilder in interface StructuredQueryOrBuilder
    • hasStartAt

      public boolean hasStartAt()
       A potential prefix of a position in the result set to start the query at.
      
       The ordering of the result set is based on the `ORDER BY` clause of the
       original query.
      
       ```
       SELECT * FROM k WHERE a = 1 AND b > 2 ORDER BY b ASC, __name__ ASC;
       ```
      
       This query's results are ordered by `(b ASC, __name__ ASC)`.
      
       Cursors can reference either the full ordering or a prefix of the location,
       though it cannot reference more fields than what are in the provided
       `ORDER BY`.
      
       Continuing off the example above, attaching the following start cursors
       will have varying impact:
      
       - `START BEFORE (2, /k/123)`: start the query right before `a = 1 AND
          b > 2 AND __name__ > /k/123`.
       - `START AFTER (10)`: start the query right after `a = 1 AND b > 10`.
      
       Unlike `OFFSET` which requires scanning over the first N results to skip,
       a start cursor allows the query to begin at a logical position. This
       position is not required to match an actual result, it will scan forward
       from this position to find the next document.
      
       Requires:
      
       * The number of values cannot be greater than the number of fields
         specified in the `ORDER BY` clause.
       
      .google.firestore.v1.Cursor start_at = 7;
      Specified by:
      hasStartAt in interface StructuredQueryOrBuilder
      Returns:
      Whether the startAt field is set.
    • getStartAt

      public Cursor getStartAt()
       A potential prefix of a position in the result set to start the query at.
      
       The ordering of the result set is based on the `ORDER BY` clause of the
       original query.
      
       ```
       SELECT * FROM k WHERE a = 1 AND b > 2 ORDER BY b ASC, __name__ ASC;
       ```
      
       This query's results are ordered by `(b ASC, __name__ ASC)`.
      
       Cursors can reference either the full ordering or a prefix of the location,
       though it cannot reference more fields than what are in the provided
       `ORDER BY`.
      
       Continuing off the example above, attaching the following start cursors
       will have varying impact:
      
       - `START BEFORE (2, /k/123)`: start the query right before `a = 1 AND
          b > 2 AND __name__ > /k/123`.
       - `START AFTER (10)`: start the query right after `a = 1 AND b > 10`.
      
       Unlike `OFFSET` which requires scanning over the first N results to skip,
       a start cursor allows the query to begin at a logical position. This
       position is not required to match an actual result, it will scan forward
       from this position to find the next document.
      
       Requires:
      
       * The number of values cannot be greater than the number of fields
         specified in the `ORDER BY` clause.
       
      .google.firestore.v1.Cursor start_at = 7;
      Specified by:
      getStartAt in interface StructuredQueryOrBuilder
      Returns:
      The startAt.
    • getStartAtOrBuilder

      public CursorOrBuilder getStartAtOrBuilder()
       A potential prefix of a position in the result set to start the query at.
      
       The ordering of the result set is based on the `ORDER BY` clause of the
       original query.
      
       ```
       SELECT * FROM k WHERE a = 1 AND b > 2 ORDER BY b ASC, __name__ ASC;
       ```
      
       This query's results are ordered by `(b ASC, __name__ ASC)`.
      
       Cursors can reference either the full ordering or a prefix of the location,
       though it cannot reference more fields than what are in the provided
       `ORDER BY`.
      
       Continuing off the example above, attaching the following start cursors
       will have varying impact:
      
       - `START BEFORE (2, /k/123)`: start the query right before `a = 1 AND
          b > 2 AND __name__ > /k/123`.
       - `START AFTER (10)`: start the query right after `a = 1 AND b > 10`.
      
       Unlike `OFFSET` which requires scanning over the first N results to skip,
       a start cursor allows the query to begin at a logical position. This
       position is not required to match an actual result, it will scan forward
       from this position to find the next document.
      
       Requires:
      
       * The number of values cannot be greater than the number of fields
         specified in the `ORDER BY` clause.
       
      .google.firestore.v1.Cursor start_at = 7;
      Specified by:
      getStartAtOrBuilder in interface StructuredQueryOrBuilder
    • hasEndAt

      public boolean hasEndAt()
       A potential prefix of a position in the result set to end the query at.
      
       This is similar to `START_AT` but with it controlling the end position
       rather than the start position.
      
       Requires:
      
       * The number of values cannot be greater than the number of fields
         specified in the `ORDER BY` clause.
       
      .google.firestore.v1.Cursor end_at = 8;
      Specified by:
      hasEndAt in interface StructuredQueryOrBuilder
      Returns:
      Whether the endAt field is set.
    • getEndAt

      public Cursor getEndAt()
       A potential prefix of a position in the result set to end the query at.
      
       This is similar to `START_AT` but with it controlling the end position
       rather than the start position.
      
       Requires:
      
       * The number of values cannot be greater than the number of fields
         specified in the `ORDER BY` clause.
       
      .google.firestore.v1.Cursor end_at = 8;
      Specified by:
      getEndAt in interface StructuredQueryOrBuilder
      Returns:
      The endAt.
    • getEndAtOrBuilder

      public CursorOrBuilder getEndAtOrBuilder()
       A potential prefix of a position in the result set to end the query at.
      
       This is similar to `START_AT` but with it controlling the end position
       rather than the start position.
      
       Requires:
      
       * The number of values cannot be greater than the number of fields
         specified in the `ORDER BY` clause.
       
      .google.firestore.v1.Cursor end_at = 8;
      Specified by:
      getEndAtOrBuilder in interface StructuredQueryOrBuilder
    • getOffset

      public int getOffset()
       The number of documents to skip before returning the first result.
      
       This applies after the constraints specified by the `WHERE`, `START AT`, &
       `END AT` but before the `LIMIT` clause.
      
       Requires:
      
       * The value must be greater than or equal to zero if specified.
       
      int32 offset = 6;
      Specified by:
      getOffset in interface StructuredQueryOrBuilder
      Returns:
      The offset.
    • hasLimit

      public boolean hasLimit()
       The maximum number of results to return.
      
       Applies after all other constraints.
      
       Requires:
      
       * The value must be greater than or equal to zero if specified.
       
      .google.protobuf.Int32Value limit = 5;
      Specified by:
      hasLimit in interface StructuredQueryOrBuilder
      Returns:
      Whether the limit field is set.
    • getLimit

      public com.google.protobuf.Int32Value getLimit()
       The maximum number of results to return.
      
       Applies after all other constraints.
      
       Requires:
      
       * The value must be greater than or equal to zero if specified.
       
      .google.protobuf.Int32Value limit = 5;
      Specified by:
      getLimit in interface StructuredQueryOrBuilder
      Returns:
      The limit.
    • getLimitOrBuilder

      public com.google.protobuf.Int32ValueOrBuilder getLimitOrBuilder()
       The maximum number of results to return.
      
       Applies after all other constraints.
      
       Requires:
      
       * The value must be greater than or equal to zero if specified.
       
      .google.protobuf.Int32Value limit = 5;
      Specified by:
      getLimitOrBuilder in interface StructuredQueryOrBuilder
    • isInitialized

      public final boolean isInitialized()
      Specified by:
      isInitialized in interface com.google.protobuf.MessageLiteOrBuilder
      Overrides:
      isInitialized in class com.google.protobuf.GeneratedMessageV3
    • writeTo

      public void writeTo(com.google.protobuf.CodedOutputStream output) throws IOException
      Specified by:
      writeTo in interface com.google.protobuf.MessageLite
      Overrides:
      writeTo in class com.google.protobuf.GeneratedMessageV3
      Throws:
      IOException
    • getSerializedSize

      public int getSerializedSize()
      Specified by:
      getSerializedSize in interface com.google.protobuf.MessageLite
      Overrides:
      getSerializedSize in class com.google.protobuf.GeneratedMessageV3
    • equals

      public boolean equals(Object obj)
      Specified by:
      equals in interface com.google.protobuf.Message
      Overrides:
      equals in class com.google.protobuf.AbstractMessage
    • hashCode

      public int hashCode()
      Specified by:
      hashCode in interface com.google.protobuf.Message
      Overrides:
      hashCode in class com.google.protobuf.AbstractMessage
    • parseFrom

      public static StructuredQuery parseFrom(ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException
      Throws:
      com.google.protobuf.InvalidProtocolBufferException
    • parseFrom

      public static StructuredQuery parseFrom(ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException
      Throws:
      com.google.protobuf.InvalidProtocolBufferException
    • parseFrom

      public static StructuredQuery parseFrom(com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException
      Throws:
      com.google.protobuf.InvalidProtocolBufferException
    • parseFrom

      public static StructuredQuery parseFrom(com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException
      Throws:
      com.google.protobuf.InvalidProtocolBufferException
    • parseFrom

      public static StructuredQuery parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException
      Throws:
      com.google.protobuf.InvalidProtocolBufferException
    • parseFrom

      public static StructuredQuery parseFrom(byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException
      Throws:
      com.google.protobuf.InvalidProtocolBufferException
    • parseFrom

      public static StructuredQuery parseFrom(InputStream input) throws IOException
      Throws:
      IOException
    • parseFrom

      public static StructuredQuery parseFrom(InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException
      Throws:
      IOException
    • parseDelimitedFrom

      public static StructuredQuery parseDelimitedFrom(InputStream input) throws IOException
      Throws:
      IOException
    • parseDelimitedFrom

      public static StructuredQuery parseDelimitedFrom(InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException
      Throws:
      IOException
    • parseFrom

      public static StructuredQuery parseFrom(com.google.protobuf.CodedInputStream input) throws IOException
      Throws:
      IOException
    • parseFrom

      public static StructuredQuery parseFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException
      Throws:
      IOException
    • newBuilderForType

      public StructuredQuery.Builder newBuilderForType()
      Specified by:
      newBuilderForType in interface com.google.protobuf.Message
      Specified by:
      newBuilderForType in interface com.google.protobuf.MessageLite
    • newBuilder

      public static StructuredQuery.Builder newBuilder()
    • newBuilder

      public static StructuredQuery.Builder newBuilder(StructuredQuery prototype)
    • toBuilder

      public StructuredQuery.Builder toBuilder()
      Specified by:
      toBuilder in interface com.google.protobuf.Message
      Specified by:
      toBuilder in interface com.google.protobuf.MessageLite
    • newBuilderForType

      protected StructuredQuery.Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)
      Specified by:
      newBuilderForType in class com.google.protobuf.GeneratedMessageV3
    • getDefaultInstance

      public static StructuredQuery getDefaultInstance()
    • parser

      public static com.google.protobuf.Parser<StructuredQuery> parser()
    • getParserForType

      public com.google.protobuf.Parser<StructuredQuery> getParserForType()
      Specified by:
      getParserForType in interface com.google.protobuf.Message
      Specified by:
      getParserForType in interface com.google.protobuf.MessageLite
      Overrides:
      getParserForType in class com.google.protobuf.GeneratedMessageV3
    • getDefaultInstanceForType

      public StructuredQuery getDefaultInstanceForType()
      Specified by:
      getDefaultInstanceForType in interface com.google.protobuf.MessageLiteOrBuilder
      Specified by:
      getDefaultInstanceForType in interface com.google.protobuf.MessageOrBuilder