Add ast nodes for SET clause
Reviewers: teon.banek Reviewed By: teon.banek Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D182
This commit is contained in:
parent
71c2813f39
commit
1cf4b95c58
@ -560,6 +560,56 @@ class Where : public Tree {
|
|||||||
Where(int uid) : Tree(uid) {}
|
Where(int uid) : Tree(uid) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class SetProperty : public Clause {
|
||||||
|
friend class AstTreeStorage;
|
||||||
|
|
||||||
|
public:
|
||||||
|
void Accept(TreeVisitorBase &visitor) override {
|
||||||
|
visitor.Visit(*this);
|
||||||
|
property_lookup_->Accept(visitor);
|
||||||
|
expression_->Accept(visitor);
|
||||||
|
visitor.PostVisit(*this);
|
||||||
|
}
|
||||||
|
PropertyLookup *property_lookup_ = nullptr;
|
||||||
|
Expression *expression_ = nullptr;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
SetProperty(int uid) : Clause(uid) {}
|
||||||
|
};
|
||||||
|
|
||||||
|
class SetProperties : public Clause {
|
||||||
|
friend class AstTreeStorage;
|
||||||
|
|
||||||
|
public:
|
||||||
|
void Accept(TreeVisitorBase &visitor) override {
|
||||||
|
visitor.Visit(*this);
|
||||||
|
identifier_->Accept(visitor);
|
||||||
|
expression_->Accept(visitor);
|
||||||
|
visitor.PostVisit(*this);
|
||||||
|
}
|
||||||
|
Identifier *identifier_ = nullptr;
|
||||||
|
Expression *expression_ = nullptr;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
SetProperties(int uid) : Clause(uid) {}
|
||||||
|
};
|
||||||
|
|
||||||
|
class SetLabels : public Clause {
|
||||||
|
friend class AstTreeStorage;
|
||||||
|
|
||||||
|
public:
|
||||||
|
void Accept(TreeVisitorBase &visitor) override {
|
||||||
|
visitor.Visit(*this);
|
||||||
|
identifier_->Accept(visitor);
|
||||||
|
visitor.PostVisit(*this);
|
||||||
|
}
|
||||||
|
Identifier *identifier_ = nullptr;
|
||||||
|
std::vector<GraphDb::Label> labels_;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
SetLabels(int uid) : Clause(uid) {}
|
||||||
|
};
|
||||||
|
|
||||||
// It would be better to call this AstTree, but we already have a class Tree,
|
// It would be better to call this AstTree, but we already have a class Tree,
|
||||||
// which could be renamed to Node or AstTreeNode, but we also have a class
|
// which could be renamed to Node or AstTreeNode, but we also have a class
|
||||||
// called NodeAtom...
|
// called NodeAtom...
|
||||||
|
@ -35,6 +35,9 @@ class LessEqualOperator;
|
|||||||
class GreaterEqualOperator;
|
class GreaterEqualOperator;
|
||||||
class Delete;
|
class Delete;
|
||||||
class Where;
|
class Where;
|
||||||
|
class SetProperty;
|
||||||
|
class SetProperties;
|
||||||
|
class SetLabels;
|
||||||
|
|
||||||
using TreeVisitorBase = ::utils::Visitor<
|
using TreeVisitorBase = ::utils::Visitor<
|
||||||
Query, NamedExpression, OrOperator, XorOperator, AndOperator, NotOperator,
|
Query, NamedExpression, OrOperator, XorOperator, AndOperator, NotOperator,
|
||||||
@ -42,5 +45,6 @@ using TreeVisitorBase = ::utils::Visitor<
|
|||||||
DivisionOperator, ModOperator, NotEqualOperator, EqualOperator,
|
DivisionOperator, ModOperator, NotEqualOperator, EqualOperator,
|
||||||
LessOperator, GreaterOperator, LessEqualOperator, GreaterEqualOperator,
|
LessOperator, GreaterOperator, LessEqualOperator, GreaterEqualOperator,
|
||||||
UnaryPlusOperator, UnaryMinusOperator, Identifier, Literal, PropertyLookup,
|
UnaryPlusOperator, UnaryMinusOperator, Identifier, Literal, PropertyLookup,
|
||||||
Create, Match, Return, Pattern, NodeAtom, EdgeAtom, Delete, Where>;
|
Create, Match, Return, Pattern, NodeAtom, EdgeAtom, Delete, Where,
|
||||||
|
SetProperty, SetProperties, SetLabels>;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user