def _to_protobuf(self) -> StructuredQuery: """Convert the current query into the equivalent protobuf. Returns: :class:`google.cloud.firestore_v1.types.StructuredQuery`: The query protobuf. """ projection = self._normalize_projection(self._projection) orders = self._normalize_orders() start_at = self._normalize_cursor(self._start_at, orders) end_at = self._normalize_cursor(self._end_at, orders) query_kwargs = { "select": projection, "from_": [ query.StructuredQuery.CollectionSelector( collection_id=self._parent.id, all_descendants=self._all_descendants ) ], "where": self._filters_pb(), "order_by": orders, "start_at": _cursor_pb(start_at), "end_at": _cursor_pb(end_at), } if self._offset is not None: query_kwargs["offset"] = self._offset if self._limit is not None: query_kwargs["limit"] = wrappers_pb2.Int32Value(value=self._limit) return query.StructuredQuery(**query_kwargs)
def _to_protobuf(self): from google.cloud.firestore_v1.types import query query_kwargs = { "select": None, "from_": None, "where": None, "order_by": None, "start_at": None, "end_at": None, } return query.StructuredQuery(**query_kwargs)