initial matador ng commit

This commit is contained in:
2025-02-02 20:37:12 +01:00
parent 19de5714f4
commit ded3daceb3
378 changed files with 14913 additions and 13431 deletions
-55
View File
@@ -1,55 +0,0 @@
#ifndef QUERY_RECIPE_HPP
#define QUERY_RECIPE_HPP
#include "matador/utils/access.hpp"
#include "matador/utils/field_attributes.hpp"
#include "matador/utils/foreign_attributes.hpp"
#include "matador/sql/entity.hpp"
#include "matador/sql/has_many_to_many_relation.hpp"
#include <string>
namespace matador::test {
struct recipe;
struct ingredient
{
unsigned long id{};
std::string name;
std::vector<matador::sql::entity<recipe>> recipes;
template<class Operator>
void process(Operator &op) {
namespace field = matador::utils::access;
field::primary_key(op, "id", id);
field::attribute(op, "name", name, 255);
field::has_many_to_many(op, "recipe_ingredients", recipes, "ingredient_id", "recipe_id", utils::fetch_type::EAGER);
}
};
struct recipe
{
unsigned long id{};
std::string name;
std::vector<matador::sql::entity<ingredient>> ingredients;
template<class Operator>
void process(Operator &op) {
namespace field = matador::utils::access;
field::primary_key(op, "id", id);
field::attribute(op, "name", name, 255);
field::has_many_to_many(op, "recipe_ingredients", ingredients, utils::fetch_type::LAZY);
}
};
class recipe_ingredient : public sql::has_many_to_many_relation<recipe, ingredient>
{
public:
recipe_ingredient()
: has_many_to_many_relation("recipe_id", "ingredient_id") {}
};
}
#endif //QUERY_RECIPE_HPP