finished relation completer
This commit is contained in:
@@ -70,10 +70,6 @@ utils::result<std::shared_ptr<attribute_definition>, utils::error> schema::refer
|
||||
return utils::ok((*result)->info().reference_column());
|
||||
}
|
||||
|
||||
if (const auto it = expected_node_map_.find(type_index); it != expected_node_map_.end()) {
|
||||
return utils::ok(it->second->info().reference_column());
|
||||
}
|
||||
|
||||
return utils::failure(result.err());
|
||||
}
|
||||
|
||||
@@ -81,7 +77,12 @@ void schema::dump(std::ostream &os) const {
|
||||
for (const auto &node : *this) {
|
||||
os << "node [" << node.name() << "] (" << node.type_index().name() << ")\n";
|
||||
for (auto it = node.info().endpoint_begin(); it != node.info().endpoint_end(); ++it) {
|
||||
os << " " << node.name() << "::" << it->second->field_name() << " (" << it->second->type_name() << ") <---> " << it->second->foreign_endpoint()->node().name() << "::" << it->second->foreign_endpoint()->field_name() << " (" << it->second->foreign_endpoint()->type_name() << ")\n";
|
||||
os << " " << /*node.name() << "::" <<*/ it->second->field_name() << " (" << it->second->type_name() << ")";
|
||||
if (it->second->foreign_endpoint()) {
|
||||
os << " <---> " << it->second->foreign_endpoint()->node().name() << "::" << it->second->foreign_endpoint()->field_name() << " (" << it->second->foreign_endpoint()->type_name() << ")\n";
|
||||
} else {
|
||||
os << "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -104,7 +105,7 @@ utils::result<schema::node_ptr, utils::error> schema::attach_node(const std::sha
|
||||
parent_node = *result;
|
||||
}
|
||||
|
||||
push_back_child(parent_node, node);
|
||||
insert_node(parent_node, node);
|
||||
|
||||
// Todo: check return value
|
||||
nodes_by_name_.insert({node->name(), node})/*.first*/;
|
||||
@@ -123,7 +124,7 @@ utils::result<schema::node_ptr, utils::error> schema::attach_node(const std::sha
|
||||
return result;
|
||||
}
|
||||
|
||||
push_back_child(*result, node);
|
||||
insert_node(*result, node);
|
||||
|
||||
// Todo: check return value
|
||||
nodes_by_name_.insert({node->name(), node})/*.first*/;
|
||||
@@ -150,7 +151,7 @@ utils::result<schema::node_ptr, utils::error> schema::find_node(const std::type_
|
||||
return utils::ok(i->second);
|
||||
}
|
||||
|
||||
void schema::push_back_child(const node_ptr &parent, const node_ptr &child) {
|
||||
void schema::insert_node(const node_ptr &parent, const node_ptr &child) {
|
||||
child->parent_ = parent;
|
||||
child->previous_sibling_ = parent->last_child_->previous_sibling_;
|
||||
child->next_sibling_ = parent->last_child_;
|
||||
|
||||
Reference in New Issue
Block a user