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
+5 -4
View File
@@ -30,15 +30,16 @@ struct Job : core::Model {
template<typename Operator>
void process( Operator& op ) {
using namespace matador;
namespace field = matador::access;
field::process( op, *matador::base_class<Model>( this ) );
field::attribute( op, "name", name, 511 );
field::attribute( op, "description", description, 511 );
field::attribute( op, "name", name, UniqueVarChar511 );
field::attribute( op, "description", description, VarChar1023 );
field::attribute( op, "state", state );
field::attribute( op, "mode", mode );
field::attribute( op, "created_at", created_at );
field::has_one(op, "payload", payload, matador::utils::CascadeAllFetchLazy );
field::belongs_to( op, "task", task, matador::utils::CascadeAllFetchLazy );
field::has_one(op, "payload", payload, utils::CascadeAllFetchLazy );
field::belongs_to( op, "task", task, utils::CascadeAllFetchLazy );
field::attribute( op, "user_info", user_info );
}
};
+3 -2
View File
@@ -16,10 +16,11 @@ struct Payload : core::Model {
template<typename Operator>
void process( Operator& op ) {
using namespace matador;
namespace field = matador::access;
field::process( op, *matador::base_class<Model>( this ) );
field::attribute( op, "type", type, 255 );
field::belongs_to( op, "job", job, matador::utils::CascadeAllFetchLazy );
field::attribute( op, "type", type, VarChar255 );
field::belongs_to( op, "job", job, utils::CascadeAllFetchLazy );
}
};
}
+5 -4
View File
@@ -26,13 +26,14 @@ struct Task : core::Model {
template<typename Operator>
void process( Operator& op ) {
using namespace matador;
namespace field = matador::access;
field::process( op, *matador::base_class<Model>( this ) );
field::attribute( op, "name", name, 511 );
field::attribute( op, "description", description, 511 );
field::attribute( op, "job_name", job_name, 511 );
field::attribute( op, "name", name, UniqueVarChar511 );
field::attribute( op, "description", description, VarChar1023 );
field::attribute( op, "job_name", job_name, VarChar511 );
field::attribute( op, "state", state );
field::belongs_to( op, "payload", payload, matador::utils::CascadeAllFetchLazy );
field::belongs_to( op, "payload", payload, utils::CascadeAllFetchLazy );
field::attribute( op, "job_mode", job_mode );
field::attribute( op, "start_delay", start_delay );
field::attribute( op, "interval", interval );