query/source/core/object/relation_endpoint.cpp

34 lines
766 B
C++

#include "matador/object/relation_endpoint.hpp"
namespace matador::object {
relation_endpoint::relation_endpoint(std::string field_name, relation_type type, const std::shared_ptr<schema_node> &node)
: field_name_(std::move(field_name))
, type_(type)
, node_(node) {
}
std::string relation_endpoint::field_name() const {
return field_name_;
}
relation_type relation_endpoint::type() const {
return type_;
}
const schema_node &relation_endpoint::node() const {
return *node_;
}
bool relation_endpoint::is_has_one() const {
return type_ == relation_type::HAS_ONE;
}
bool relation_endpoint::is_has_many() const {
return type_ == relation_type::HAS_MANY;
}
bool relation_endpoint::is_belongs_to() const {
return type_ == relation_type::BELONGS_TO;
}
}