introduced field_attributes shortcuts and added method on_base() to all processor classes
This commit is contained in:
+11
-8
@@ -81,11 +81,12 @@ struct profile {
|
||||
|
||||
template<typename Operator>
|
||||
void process(Operator &op) {
|
||||
namespace field = matador::access;
|
||||
using namespace matador;
|
||||
namespace field = access;
|
||||
field::primary_key( op, "id", id );
|
||||
field::attribute( op, "first_name", first_name, 255 );
|
||||
field::attribute( op, "last_name", last_name, 255 );
|
||||
field::belongs_to( op, "user_id", user, matador::utils::CascadeNoneFetchLazy );
|
||||
field::attribute( op, "first_name", first_name, VarChar255 );
|
||||
field::attribute( op, "last_name", last_name, VarChar255 );
|
||||
field::belongs_to( op, "user_id", user, utils::CascadeNoneFetchLazy );
|
||||
}
|
||||
};
|
||||
struct user {
|
||||
@@ -95,10 +96,11 @@ struct user {
|
||||
|
||||
template<typename Operator>
|
||||
void process(Operator &op) {
|
||||
namespace field = matador::access;
|
||||
using namespace matador;
|
||||
namespace field = access;
|
||||
field::primary_key( op, "id", id );
|
||||
field::attribute( op, "username", username, 255 );
|
||||
field::has_one(op, "profile_id", profile, matador::utils::CascadeNoneFetchLazy );
|
||||
field::attribute( op, "username", username, VarChar255 );
|
||||
field::has_one(op, "profile_id", profile, utils::CascadeNoneFetchLazy );
|
||||
}
|
||||
};
|
||||
|
||||
@@ -108,9 +110,10 @@ struct person {
|
||||
|
||||
template<typename Operator>
|
||||
void process(Operator &op) {
|
||||
using namespace matador;
|
||||
namespace field = matador::access;
|
||||
field::primary_key( op, "id", id );
|
||||
field::attribute( op, "name", name, 255 );
|
||||
field::attribute( op, "name", name, VarChar255 );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user