object generation progress
This commit is contained in:
@@ -7,8 +7,8 @@ namespace matador::object {
|
||||
restriction::restriction(std::string name)
|
||||
: name_(std::move(name)) {}
|
||||
|
||||
const std::string & restriction::name() const {
|
||||
return name_;
|
||||
std::string restriction::name() const {
|
||||
return prefix() + name_;
|
||||
}
|
||||
|
||||
const class attribute* restriction::attribute() const {
|
||||
@@ -55,10 +55,23 @@ const std::string& restriction::ref_column_name() const {
|
||||
}
|
||||
|
||||
std::ostream & operator<<(std::ostream &os, const class restriction &c) {
|
||||
os << "constraint " << c.name_ << " for column " << c.column_name();
|
||||
os << "constraint " << c.name() << " for column " << c.column_name();
|
||||
return os;
|
||||
}
|
||||
|
||||
std::string restriction::prefix() const {
|
||||
if (utils::is_constraint_set(options_, utils::constraints::PrimaryKey)) {
|
||||
return "PK_";
|
||||
}
|
||||
if (utils::is_constraint_set(options_, utils::constraints::ForeignKey)) {
|
||||
return "FK_";
|
||||
}
|
||||
if (utils::is_constraint_set(options_, utils::constraints::Unique)) {
|
||||
return "UK_";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
// constraint_builder & constraint_builder::constraint(std::string name) {
|
||||
// constraint_name = std::move(name);
|
||||
// return *this;
|
||||
|
||||
Reference in New Issue
Block a user