query/demo/book.hpp

27 lines
693 B
C++

#ifndef BOOK_HPP
#define BOOK_HPP
#include "matador/object/object_ptr.hpp"
#include "matador/utils/access.hpp"
namespace demo {
struct author;
struct book {
unsigned int id{};
matador::object::object_ptr<author> book_author;
std::string title;
unsigned short published_in{};
template<typename Operator>
void process( Operator& op ) {
namespace field = matador::access;
field::primary_key( op, "id", id );
field::attribute( op, "title", title, 511 );
field::has_one( op, "author_id", book_author, matador::utils::default_foreign_attributes );
field::attribute( op, "published_in", published_in );
}
};
}
#endif //BOOK_HPP