#ifndef DEPARTMENT_EMPLOYEE_HPP #define DEPARTMENT_EMPLOYEE_HPP #include "matador/object/object_ptr.hpp" #include #include namespace matador::test { struct employee; struct department { unsigned int id{}; std::string name; std::vector> employees; // object::object_ptr manager; template void process(Operator &op) { namespace field = matador::access; field::primary_key(op, "id", id); field::attribute(op, "name", name, 63); field::has_many(op, "employees", employees, "dep_id", utils::fetch_type::EAGER); // field::belongs_to(op, "manager_id", manager, utils::fetch_type::EAGER); } }; struct employee { unsigned int id{}; std::string first_name; std::string last_name; object::object_ptr dep; template void process(Operator &op) { namespace field = matador::access; field::primary_key(op, "id", id); field::attribute(op, "first_name", first_name, 63); field::attribute(op, "last_name", last_name, 63); field::belongs_to(op, "dep_id", dep, utils::fetch_type::EAGER); } }; } #endif //DEPARTMENT_EMPLOYEE_HPP