introduced field_attributes shortcuts and added method on_base() to all processor classes
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
#include "matador/object/object_ptr.hpp"
|
||||
|
||||
#include "matador/utils/access.hpp"
|
||||
#include "matador/utils/field_attributes.hpp"
|
||||
#include "matador/utils/foreign_attributes.hpp"
|
||||
|
||||
#include <string>
|
||||
@@ -13,7 +14,7 @@ struct author;
|
||||
|
||||
struct book {
|
||||
book() = default;
|
||||
book(const unsigned int id, std::string title, object::object_ptr<author> author, unsigned short published_in)
|
||||
book(const unsigned int id, std::string title, object::object_ptr<author> author, const unsigned short published_in)
|
||||
: id(id), title(std::move(title)), book_author(std::move(author)), published_in(published_in) {}
|
||||
unsigned int id{};
|
||||
std::string title;
|
||||
@@ -24,7 +25,7 @@ struct book {
|
||||
void process(Operator &op) {
|
||||
namespace field = matador::access;
|
||||
field::primary_key(op, "id", id);
|
||||
field::attribute(op, "title", title, 511);
|
||||
field::attribute(op, "title", title, VarChar511);
|
||||
field::belongs_to(op, "author_id", book_author, utils::CascadeAllFetchEager);
|
||||
field::attribute(op, "published_in", published_in);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user