introduced field_attributes shortcuts and added method on_base() to all processor classes

This commit is contained in:
2026-04-22 11:03:33 +02:00
parent 78eb5d04cd
commit 9b25f7f556
68 changed files with 248 additions and 151 deletions
+10 -10
View File
@@ -13,8 +13,7 @@
namespace demo {
struct recipe;
struct ingredient
{
struct ingredient {
unsigned int id{};
std::string name;
matador::object::collection<matador::object::object_ptr<demo::recipe>> recipes{};
@@ -25,15 +24,15 @@ struct ingredient
template<class Operator>
void process(Operator &op) {
namespace field = matador::access;
using namespace matador;
namespace field = access;
field::primary_key(op, "id", id);
field::attribute(op, "name", name, 255);
field::has_many_to_many(op, "recipe_ingredients", recipes, "ingredient_id", "recipe_id", matador::utils::fetch_type::Eager);
field::attribute(op, "name", name, VarChar255);
field::has_many_to_many(op, "recipe_ingredients", recipes, "ingredient_id", "recipe_id", utils::CascadeAllFetchEager);
}
};
struct recipe
{
struct recipe {
unsigned int id{};
std::string name;
matador::object::collection<matador::object::object_ptr<demo::ingredient>> ingredients{};
@@ -44,10 +43,11 @@ struct recipe
template<class Operator>
void process(Operator &op) {
namespace field = matador::access;
using namespace matador;
namespace field = access;
field::primary_key(op, "id", id);
field::attribute(op, "name", name, 255);
field::has_many_to_many(op, "recipe_ingredients", ingredients, matador::utils::fetch_type::Lazy);
field::attribute(op, "name", name, VarChar255);
field::has_many_to_many(op, "recipe_ingredients", ingredients, utils::CascadeAllFetchLazy);
}
};