object generation progress

This commit is contained in:
Sascha Kühl
2025-12-10 17:05:24 +01:00
parent 9b7b74524f
commit 5afb616205
9 changed files with 59 additions and 45 deletions
+16 -3
View File
@@ -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;