added timestamp code, support columns for group by and order by and tested load has-many eager code
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
#ifndef MATADOR_SHIPMENT_HPP
|
||||
#define MATADOR_SHIPMENT_HPP
|
||||
|
||||
#include "matador/utils/access.hpp"
|
||||
#include "matador/utils/foreign_attributes.hpp"
|
||||
|
||||
#include "matador/object/collection.hpp"
|
||||
#include "matador/object/object_ptr.hpp"
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace matador::test {
|
||||
struct package;
|
||||
struct shipment {
|
||||
long id{};
|
||||
std::string tracking_number;
|
||||
object::collection<object::object_ptr<package>> packages{};
|
||||
|
||||
template<typename Operator>
|
||||
void process(Operator &op) {
|
||||
namespace field = matador::access;
|
||||
field::primary_key(op, "id", id);
|
||||
field::attribute(op, "tracking_number", tracking_number, 255);
|
||||
field::has_many(op, "packages", packages, "shipment_id", utils::CascadeAllFetchEager);
|
||||
}
|
||||
};
|
||||
|
||||
struct package {
|
||||
long id{};
|
||||
double weight{};
|
||||
object::object_ptr<shipment> delivery;
|
||||
|
||||
template<typename Operator>
|
||||
void process(Operator &op) {
|
||||
namespace field = matador::access;
|
||||
field::primary_key(op, "id", id);
|
||||
field::attribute(op, "weight", weight);
|
||||
field::belongs_to(op, "shipment", delivery, utils::CascadeAllFetchLazy);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif //MATADOR_SHIPMENT_HPP
|
||||
Reference in New Issue
Block a user