added belongs-to-eager test

This commit is contained in:
2026-01-10 18:54:18 +01:00
parent b9f5819be5
commit db8e137c11
20 changed files with 403 additions and 278 deletions
+12 -14
View File
@@ -9,24 +9,22 @@
#include <string>
namespace matador::test {
struct author;
struct book {
unsigned int id{};
std::string title;
object::object_ptr<author> book_author;
unsigned short published_in{};
unsigned int id{};
std::string title;
object::object_ptr<author> book_author;
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::belongs_to(op, "author_id", book_author, utils::fetch_type::Eager);
field::attribute(op, "published_in", 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::belongs_to(op, "author_id", book_author, utils::CascadeAllFetchEager);
field::attribute(op, "published_in", published_in);
}
};
}
#endif //QUERY_BOOK_HPP