51 lines
1.5 KiB
C++
51 lines
1.5 KiB
C++
#ifndef QUERY_ORDER_HPP
|
|
#define QUERY_ORDER_HPP
|
|
|
|
#include "order_details.h"
|
|
|
|
#include "matador/utils/access.hpp"
|
|
|
|
#include "matador/sql/entity.hpp"
|
|
|
|
#include <vector>
|
|
|
|
namespace matador::test {
|
|
|
|
struct order
|
|
{
|
|
unsigned long order_id{};
|
|
std::string order_date;
|
|
std::string required_date;
|
|
std::string shipped_date;
|
|
unsigned int ship_via{};
|
|
unsigned int freight{};
|
|
std::string ship_name;
|
|
std::string ship_address;
|
|
std::string ship_city;
|
|
std::string ship_region;
|
|
std::string ship_postal_code;
|
|
std::string ship_country;
|
|
std::vector<sql::entity<order_details>> order_details_;
|
|
|
|
template<class Operator>
|
|
void process(Operator &op) {
|
|
namespace field = matador::utils::access;
|
|
field::primary_key(op, "order_id", order_id);
|
|
field::attribute(op, "order_date", order_date, 255);
|
|
field::attribute(op, "required_date", required_date, 255);
|
|
field::attribute(op, "shipped_date", shipped_date, 255);
|
|
field::attribute(op, "ship_via", ship_via);
|
|
field::attribute(op, "freight", freight);
|
|
field::attribute(op, "ship_name", ship_name, 255);
|
|
field::attribute(op, "ship_address", ship_address, 255);
|
|
field::attribute(op, "ship_city", ship_city, 255);
|
|
field::attribute(op, "ship_region", ship_region, 255);
|
|
field::attribute(op, "ship_postal_code", ship_postal_code, 255);
|
|
field::attribute(op, "ship_country", ship_country, 255);
|
|
field::has_many(op, "order_details", order_details_, fetch_type::EAGER);
|
|
}
|
|
};
|
|
|
|
}
|
|
#endif //QUERY_ORDER_HPP
|