31 lines
760 B
C++
31 lines
760 B
C++
#ifndef QUERY_ORDER_DETAILS_HPP
|
|
#define QUERY_ORDER_DETAILS_HPP
|
|
|
|
#include "product.hpp"
|
|
|
|
#include "matador/object/object_ptr.hpp"
|
|
|
|
#include "matador/utils/foreign_attributes.hpp"
|
|
|
|
namespace matador::test {
|
|
|
|
struct order;
|
|
|
|
struct order_details
|
|
{
|
|
unsigned int order_details_id;
|
|
matador::object::object_ptr<order> order_;
|
|
matador::object::object_ptr<product> product_;
|
|
|
|
template<class Operator>
|
|
void process(Operator &op) {
|
|
namespace field = matador::access;
|
|
field::primary_key(op, "order_details_id", order_details_id);
|
|
field::belongs_to(op, "order_id", order_, utils::CascadeNoneFetchLazy);
|
|
field::has_one(op, "product_id", product_, utils::CascadeNoneFetchLazy);
|
|
}
|
|
};
|
|
|
|
}
|
|
#endif //QUERY_ORDER_DETAILS_HPP
|