#ifndef QUERY_BOOK_HPP #define QUERY_BOOK_HPP #include "matador/object/object_ptr.hpp" #include "matador/utils/access.hpp" #include "matador/utils/foreign_attributes.hpp" #include namespace matador::test { struct author; struct book { book() = default; book(const unsigned int id, std::string title, object::object_ptr author, 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; object::object_ptr book_author; unsigned short published_in{}; template void process(Operator &op) { namespace field = matador::access; field::primary_key(op, "id", id); field::attribute(op, "title", title, 511); field::belongs_to(op, "author_id", book_author, utils::CascadeAllFetchEager); field::attribute(op, "published_in", published_in); } }; } #endif //QUERY_BOOK_HPP