Compare commits

...

2 Commits

Author SHA1 Message Date
Sascha Kühl 6cb501ded9 enabled has many relation 2025-02-07 13:00:33 +01:00
Sascha Kühl 73c13026d8 added missing types 2025-02-07 13:00:13 +01:00
2 changed files with 5 additions and 3 deletions

View File

@ -25,7 +25,7 @@ struct order
std::string ship_region;
std::string ship_postal_code;
std::string ship_country;
std::vector<matador::object::object_ptr<order_details>> order_details_;
std::vector<object::object_ptr<order_details>> order_details_;
template<class Operator>
void process(Operator &op) {
@ -42,7 +42,7 @@ struct order
field::attribute(op, "ship_region", ship_region, 255);
field::attribute(op, "ship_postal_code", ship_postal_code, 255);
field::attribute(op, "ship_country", ship_country, 255);
// field::has_many(op, order_details_, "order_id", utils::fetch_type::EAGER);
field::has_many(op, "order_details", order_details_, "order_id", utils::fetch_type::EAGER);
}
};

View File

@ -42,8 +42,10 @@ TEST_CASE("Generate columns from object", "[column][generator]") {
TEST_CASE("Generate columns for object with has many relation", "[column][generator][relation]") {
using namespace matador::test;
schema s("main");
auto result = s.attach<product>("product")
auto result = s.attach<supplier>("supplier")
.and_then( [&s] { return s.attach<category>("categories"); } )
.and_then( [&s] { return s.attach<order_details>("order_details"); } )
.and_then( [&s] { return s.attach<product>("products"); } )
.and_then( [&s] { return s.attach<order>("order"); } );
REQUIRE(result);