2016-07-25 09:09:40 +08:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "query_engine/code_generator/handlers/includes.hpp"
|
|
|
|
|
|
|
|
auto set_query_action = [](CypherStateData &cypher_data,
|
|
|
|
const QueryActionData &action_data) -> std::string {
|
|
|
|
|
|
|
|
std::string code = "";
|
|
|
|
|
|
|
|
for (auto const &kv : action_data.actions) {
|
|
|
|
auto name = kv.first;
|
2016-08-01 01:58:12 +08:00
|
|
|
|
2016-07-25 09:09:40 +08:00
|
|
|
if (kv.second == ClauseAction::UpdateNode &&
|
|
|
|
cypher_data.status(name) == EntityStatus::Matched &&
|
|
|
|
cypher_data.type(name) == EntityType::Node) {
|
2016-08-20 01:40:04 +08:00
|
|
|
code += update_properties(cypher_data, action_data, name);
|
2016-08-01 01:58:12 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (kv.second == ClauseAction::UpdateRelationship &&
|
|
|
|
cypher_data.status(name) == EntityStatus::Matched &&
|
|
|
|
cypher_data.type(name) == EntityType::Relationship) {
|
2016-08-20 01:40:04 +08:00
|
|
|
code += update_properties(cypher_data, action_data, name);
|
2016-07-25 09:09:40 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return code;
|
|
|
|
};
|