enabled has many relations and removed obsolete namespaces
This commit is contained in:
parent
81cd8eecb2
commit
936ba06458
|
|
@ -21,7 +21,7 @@ struct flight
|
||||||
: id(id), airplane(plane), pilot_name(std::move(name)) {}
|
: id(id), airplane(plane), pilot_name(std::move(name)) {}
|
||||||
|
|
||||||
unsigned int id{};
|
unsigned int id{};
|
||||||
object::object_ptr<test::airplane> airplane;
|
object::object_ptr<airplane> airplane;
|
||||||
std::string pilot_name;
|
std::string pilot_name;
|
||||||
|
|
||||||
template<class Operator>
|
template<class Operator>
|
||||||
|
|
@ -29,7 +29,7 @@ struct flight
|
||||||
namespace field = matador::access;
|
namespace field = matador::access;
|
||||||
using namespace matador::utils;
|
using namespace matador::utils;
|
||||||
field::primary_key(op, "id", id);
|
field::primary_key(op, "id", id);
|
||||||
// field::has_one(op, "airplane_id", airplane, {utils::cascade_type::ALL, utils::fetch_type::EAGER});
|
field::has_one(op, "airplane_id", airplane, {utils::cascade_type::ALL, utils::fetch_type::EAGER});
|
||||||
field::attribute(op, "pilot_name", pilot_name, 255);
|
field::attribute(op, "pilot_name", pilot_name, 255);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,8 @@ namespace matador::test {
|
||||||
|
|
||||||
struct product {
|
struct product {
|
||||||
std::string product_name;
|
std::string product_name;
|
||||||
object::object_ptr<test::supplier> supplier;
|
object::object_ptr<supplier> supplier;
|
||||||
object::object_ptr<test::category> category;
|
object::object_ptr<category> category;
|
||||||
std::string quantity_per_unit;
|
std::string quantity_per_unit;
|
||||||
unsigned int unit_price;
|
unsigned int unit_price;
|
||||||
unsigned int units_in_stock;
|
unsigned int units_in_stock;
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ struct course;
|
||||||
struct student {
|
struct student {
|
||||||
unsigned int id{};
|
unsigned int id{};
|
||||||
std::string name;
|
std::string name;
|
||||||
std::vector<matador::object::object_ptr<course>> courses;
|
std::vector<object::object_ptr<course>> courses;
|
||||||
|
|
||||||
student() = default;
|
student() = default;
|
||||||
explicit student(unsigned int id, std::string name)
|
explicit student(unsigned int id, std::string name)
|
||||||
|
|
@ -29,7 +29,7 @@ struct student {
|
||||||
namespace field = matador::access;
|
namespace field = matador::access;
|
||||||
field::primary_key(op, "id", id);
|
field::primary_key(op, "id", id);
|
||||||
field::attribute(op, "name", name, 255);
|
field::attribute(op, "name", name, 255);
|
||||||
// field::has_many_to_many(op, "student_courses", courses, "student_id", "course_id", utils::fetch_type::LAZY);
|
field::has_many_to_many(op, "student_courses", courses, "student_id", "course_id", utils::fetch_type::LAZY);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
@ -37,7 +37,7 @@ struct student {
|
||||||
struct course {
|
struct course {
|
||||||
unsigned int id{};
|
unsigned int id{};
|
||||||
std::string title;
|
std::string title;
|
||||||
std::vector<matador::object::object_ptr<student>> students;
|
std::vector<object::object_ptr<student>> students;
|
||||||
|
|
||||||
course() = default;
|
course() = default;
|
||||||
explicit course(unsigned int id, std::string title)
|
explicit course(unsigned int id, std::string title)
|
||||||
|
|
@ -49,7 +49,7 @@ struct course {
|
||||||
namespace field = matador::access;
|
namespace field = matador::access;
|
||||||
field::primary_key(op, "id", id);
|
field::primary_key(op, "id", id);
|
||||||
field::attribute(op, "title", title, 255);
|
field::attribute(op, "title", title, 255);
|
||||||
// field::has_many_to_many(op, "student_courses", students, utils::fetch_type::EAGER);
|
field::has_many_to_many(op, "student_courses", students, utils::fetch_type::EAGER);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue