#ifndef OOS_ACCESS_HPP #define OOS_ACCESS_HPP #include "matador/utils/primary_key_attribute.hpp" #include "matador/utils/field_attributes.hpp" #include "matador/utils/foreign_attributes.hpp" #include namespace matador { enum class cascade_type; namespace utils { class field_attributes; class foreign_attributes; class primary_key_attribute; } namespace access { template void process(Operator &op, Type &object) { object.process(op); } template void process(Operator &op, const Type &object) { process(op, const_cast(object)); } template void process_base(Operator &op, const Derived &object) { static_assert(!std::is_same_v, "class Base must not be of same type as class Derived"); static_assert(std::is_base_of_v, "class Base must be base of class Derived"); op.on_base(static_cast(object)); } template void process_base(Operator &op, Derived &object) { static_assert(!std::is_same_v, "class Base must not be of same type as class Derived"); static_assert(std::is_base_of_v, "class Base must be base of class Derived"); op.on_base(static_cast(object)); } template< class Operator, class Type > void primary_key(Operator &op, const char *id, Type &value, const utils::primary_key_attribute &attr = utils::DefaultPkAttributes) { op.on_primary_key(id, value, attr); } template void revision(Operator &op, const char *id, uint64_t &value) { op.on_revision(id, value); } template void attribute(Operator &op, const char *id, Type &value, const utils::field_attributes &attr = utils::NullAttributes) { op.on_attribute(id, value, attr); } template void attribute(Operator &op, const char *id, std::optional &value, const utils::field_attributes &attr = utils::NullAttributes) { op.on_attribute(id, value, attr); } template void has_one(Operator &op, const char *id, Type &value, const utils::foreign_attributes &attr = utils::CascadeNoneFetchLazy) { op.on_has_one(id, value, attr); } template void belongs_to(Operator &op, const char *id, Type &value, const utils::foreign_attributes &attr = utils::CascadeNoneFetchLazy) { op.on_belongs_to(id, value, attr); } template class ContainerType> void has_many(Operator &op, const char *id, ContainerType &c, const char *join_column, const utils::foreign_attributes &attr = utils::CascadeNoneFetchLazy) { op.on_has_many(id, c, join_column, attr); } template class ContainerType> void has_many(Operator &op, const char *id, ContainerType &c, const utils::foreign_attributes &attr = utils::CascadeNoneFetchLazy) { op.on_has_many(id, c, attr); } template void has_many_to_many(Operator &op, const char *id, ContainerType &c, const char *join_column, const char *inverse_join_column, const utils::foreign_attributes &attr = utils::CascadeNoneFetchLazy) { op.on_has_many_to_many(id, c, join_column, inverse_join_column, attr); } template void has_many_to_many(Operator &op, const char *id, ContainerType &c, const utils::foreign_attributes &attr = utils::CascadeNoneFetchLazy) { op.on_has_many_to_many(id, c, attr); } } } #endif //OOS_ACCESS_HPP