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
@@ -71,25 +72,29 @@ class EvaluableStage : public Stage {
7172 EvaluableStage () = default ;
7273 virtual ~EvaluableStage () = default ;
7374
75+ virtual absl::string_view name () const = 0;
7476 virtual model::PipelineInputOutputVector Evaluate (
7577 const EvaluateContext& context,
7678 const model::PipelineInputOutputVector& inputs) const = 0;
7779};
7880
7981class CollectionSource : public EvaluableStage {
8082 public:
81- explicit CollectionSource (std::string path) : path_(std::move(path)) {
82- }
83+ explicit CollectionSource (std::string path);
8384 ~CollectionSource () override = default ;
8485
8586 google_firestore_v1_Pipeline_Stage to_proto () const override ;
8687
88+ absl::string_view name () const override {
89+ return " collection" ;
90+ }
91+
8792 model::PipelineInputOutputVector Evaluate (
8893 const EvaluateContext& context,
8994 const model::PipelineInputOutputVector& inputs) const override ;
9095
9196 private:
92- std::string path_;
97+ model::ResourcePath path_;
9398};
9499
95100class DatabaseSource : public EvaluableStage {
@@ -98,12 +103,17 @@ class DatabaseSource : public EvaluableStage {
98103 ~DatabaseSource () override = default ;
99104
100105 google_firestore_v1_Pipeline_Stage to_proto () const override ;
106+
107+ absl::string_view name () const override {
108+ return " database" ;
109+ }
110+
101111 model::PipelineInputOutputVector Evaluate (
102112 const EvaluateContext& context,
103113 const model::PipelineInputOutputVector& inputs) const override ;
104114};
105115
106- class CollectionGroupSource : public Stage {
116+ class CollectionGroupSource : public EvaluableStage {
107117 public:
108118 explicit CollectionGroupSource (std::string collection_id)
109119 : collection_id_(std::move(collection_id)) {
@@ -112,6 +122,14 @@ class CollectionGroupSource : public Stage {
112122
113123 google_firestore_v1_Pipeline_Stage to_proto () const override ;
114124
125+ absl::string_view name () const override {
126+ return " collection_group" ;
127+ }
128+
129+ model::PipelineInputOutputVector Evaluate (
130+ const EvaluateContext& context,
131+ const model::PipelineInputOutputVector& inputs) const override ;
132+
115133 private:
116134 std::string collection_id_;
117135};
@@ -125,6 +143,10 @@ class DocumentsSource : public Stage {
125143
126144 google_firestore_v1_Pipeline_Stage to_proto () const override ;
127145
146+ absl::string_view name () const {
147+ return " documents" ;
148+ }
149+
128150 private:
129151 std::vector<std::string> documents_;
130152};
@@ -167,6 +189,11 @@ class Where : public EvaluableStage {
167189 ~Where () override = default ;
168190
169191 google_firestore_v1_Pipeline_Stage to_proto () const override ;
192+
193+ absl::string_view name () const override {
194+ return " where" ;
195+ }
196+
170197 model::PipelineInputOutputVector Evaluate (
171198 const EvaluateContext& context,
172199 const model::PipelineInputOutputVector& inputs) const override ;
@@ -218,6 +245,11 @@ class LimitStage : public EvaluableStage {
218245 ~LimitStage () override = default ;
219246
220247 google_firestore_v1_Pipeline_Stage to_proto () const override ;
248+
249+ absl::string_view name () const override {
250+ return " limit" ;
251+ }
252+
221253 model::PipelineInputOutputVector Evaluate (
222254 const EvaluateContext& context,
223255 const model::PipelineInputOutputVector& inputs) const override ;
@@ -252,17 +284,29 @@ class SelectStage : public Stage {
252284 std::unordered_map<std::string, std::shared_ptr<Expr>> fields_;
253285};
254286
255- class SortStage : public Stage {
287+ class SortStage : public EvaluableStage {
256288 public:
257- explicit SortStage (std::vector<std::shared_ptr< Ordering> > orders)
289+ explicit SortStage (std::vector<Ordering> orders)
258290 : orders_(std::move(orders)) {
259291 }
260292 ~SortStage () override = default ;
261293
262294 google_firestore_v1_Pipeline_Stage to_proto () const override ;
263295
296+ absl::string_view name () const override {
297+ return " sort" ;
298+ }
299+
300+ model::PipelineInputOutputVector Evaluate (
301+ const EvaluateContext& context,
302+ const model::PipelineInputOutputVector& inputs) const override ;
303+
304+ const std::vector<Ordering>& orders () const {
305+ return orders_;
306+ }
307+
264308 private:
265- std::vector<std::shared_ptr< Ordering> > orders_;
309+ std::vector<Ordering> orders_;
266310};
267311
268312class DistinctStage : public Stage {
0 commit comments