2929#include " Firestore/core/src/api/expressions.h"
3030#include " Firestore/core/src/api/ordering.h"
3131#include " Firestore/core/src/model/model_fwd.h"
32+ #include " Firestore/core/src/model/resource_path.h"
3233#include " Firestore/core/src/nanopb/message.h"
3334#include " absl/types/optional.h"
3435
@@ -68,25 +69,29 @@ class EvaluableStage : public Stage {
6869 EvaluableStage () = default ;
6970 virtual ~EvaluableStage () = default ;
7071
72+ virtual absl::string_view name () const = 0;
7173 virtual model::PipelineInputOutputVector Evaluate (
7274 const EvaluateContext& context,
7375 const model::PipelineInputOutputVector& inputs) const = 0;
7476};
7577
7678class CollectionSource : public EvaluableStage {
7779 public:
78- explicit CollectionSource (std::string path) : path_(std::move(path)) {
79- }
80+ explicit CollectionSource (std::string path);
8081 ~CollectionSource () override = default ;
8182
8283 google_firestore_v1_Pipeline_Stage to_proto () const override ;
8384
85+ absl::string_view name () const override {
86+ return " collection" ;
87+ }
88+
8489 model::PipelineInputOutputVector Evaluate (
8590 const EvaluateContext& context,
8691 const model::PipelineInputOutputVector& inputs) const override ;
8792
8893 private:
89- std::string path_;
94+ model::ResourcePath path_;
9095};
9196
9297class DatabaseSource : public EvaluableStage {
@@ -95,12 +100,17 @@ class DatabaseSource : public EvaluableStage {
95100 ~DatabaseSource () override = default ;
96101
97102 google_firestore_v1_Pipeline_Stage to_proto () const override ;
103+
104+ absl::string_view name () const override {
105+ return " database" ;
106+ }
107+
98108 model::PipelineInputOutputVector Evaluate (
99109 const EvaluateContext& context,
100110 const model::PipelineInputOutputVector& inputs) const override ;
101111};
102112
103- class CollectionGroupSource : public Stage {
113+ class CollectionGroupSource : public EvaluableStage {
104114 public:
105115 explicit CollectionGroupSource (std::string collection_id)
106116 : collection_id_(std::move(collection_id)) {
@@ -109,6 +119,14 @@ class CollectionGroupSource : public Stage {
109119
110120 google_firestore_v1_Pipeline_Stage to_proto () const override ;
111121
122+ absl::string_view name () const override {
123+ return " collection_group" ;
124+ }
125+
126+ model::PipelineInputOutputVector Evaluate (
127+ const EvaluateContext& context,
128+ const model::PipelineInputOutputVector& inputs) const override ;
129+
112130 private:
113131 std::string collection_id_;
114132};
@@ -122,6 +140,10 @@ class DocumentsSource : public Stage {
122140
123141 google_firestore_v1_Pipeline_Stage to_proto () const override ;
124142
143+ absl::string_view name () const {
144+ return " documents" ;
145+ }
146+
125147 private:
126148 std::vector<std::string> documents_;
127149};
@@ -164,6 +186,11 @@ class Where : public EvaluableStage {
164186 ~Where () override = default ;
165187
166188 google_firestore_v1_Pipeline_Stage to_proto () const override ;
189+
190+ absl::string_view name () const override {
191+ return " where" ;
192+ }
193+
167194 model::PipelineInputOutputVector Evaluate (
168195 const EvaluateContext& context,
169196 const model::PipelineInputOutputVector& inputs) const override ;
@@ -215,6 +242,11 @@ class LimitStage : public EvaluableStage {
215242 ~LimitStage () override = default ;
216243
217244 google_firestore_v1_Pipeline_Stage to_proto () const override ;
245+
246+ absl::string_view name () const override {
247+ return " limit" ;
248+ }
249+
218250 model::PipelineInputOutputVector Evaluate (
219251 const EvaluateContext& context,
220252 const model::PipelineInputOutputVector& inputs) const override ;
@@ -249,17 +281,29 @@ class SelectStage : public Stage {
249281 std::unordered_map<std::string, std::shared_ptr<Expr>> fields_;
250282};
251283
252- class SortStage : public Stage {
284+ class SortStage : public EvaluableStage {
253285 public:
254- explicit SortStage (std::vector<std::shared_ptr< Ordering> > orders)
286+ explicit SortStage (std::vector<Ordering> orders)
255287 : orders_(std::move(orders)) {
256288 }
257289 ~SortStage () override = default ;
258290
259291 google_firestore_v1_Pipeline_Stage to_proto () const override ;
260292
293+ absl::string_view name () const override {
294+ return " sort" ;
295+ }
296+
297+ model::PipelineInputOutputVector Evaluate (
298+ const EvaluateContext& context,
299+ const model::PipelineInputOutputVector& inputs) const override ;
300+
301+ const std::vector<Ordering>& orders () const {
302+ return orders_;
303+ }
304+
261305 private:
262- std::vector<std::shared_ptr< Ordering> > orders_;
306+ std::vector<Ordering> orders_;
263307};
264308
265309class DistinctStage : public Stage {
0 commit comments