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
+3 -9
View File
@@ -2,11 +2,11 @@
#define QUERY_STUDENT_HPP
#include "matador/utils/access.hpp"
#include "matador/utils/field_attributes.hpp"
#include "matador/utils/foreign_attributes.hpp"
#include "matador/object/object_ptr.hpp"
#include "matador/object/collection.hpp"
#include "matador/object/many_to_many_relation.hpp"
#include <utility>
#include <vector>
@@ -30,7 +30,7 @@ struct student {
void process(Operator &op) {
namespace field = matador::access;
field::primary_key(op, "id", id);
field::attribute(op, "name", name, 255);
field::attribute(op, "name", name, UniqueVarChar255);
field::has_many_to_many(op, "student_courses", courses, "student_id", "course_id", utils::CascadeAllFetchLazy);
}
};
@@ -51,15 +51,9 @@ struct course {
void process(Operator &op) {
namespace field = matador::access;
field::primary_key(op, "id", id);
field::attribute(op, "title", title, 255);
field::attribute(op, "title", title, UniqueVarChar255);
field::has_many_to_many(op, "student_courses", students, utils::CascadeAllFetchEager);
}
};
class student_course : public object::many_to_many_relation<student, course> {
public:
student_course() : many_to_many_relation("student_id", "course_id") {
}
};
}
#endif //QUERY_STUDENT_HPP