renamed cascade_type enums

This commit is contained in:
Sascha Kühl 2026-02-04 15:18:46 +01:00
parent 11bba90ded
commit 018e27a22a
3 changed files with 13 additions and 14 deletions

View File

@ -1,18 +1,17 @@
#ifndef OOS_CASCADE_TYPE_HPP
#define OOS_CASCADE_TYPE_HPP
#ifndef MATADOR_CASCADE_TYPE_HPP
#define MATADOR_CASCADE_TYPE_HPP
namespace matador::utils {
/**
* @brief Cascade types for database actions
*/
enum class cascade_type
{
NONE = 0, /**< Cascade type none */
REMOVE = 1, /**< Cascade type remove */
UPDATE = 2, /**< Cascade type update */
INSERT = 4, /**< Cascade type insert */
ALL = REMOVE | UPDATE | INSERT /**< Cascade type all */
enum class cascade_type : uint8_t {
None = 0, /**< Cascade type none */
Remove = 1, /**< Cascade type remove */
Update = 2, /**< Cascade type update */
Insert = 4, /**< Cascade type insert */
All = Remove | Update | Insert /**< Cascade type all */
};
inline cascade_type operator~ (cascade_type a) { return static_cast<cascade_type>(~static_cast<int>(a)); }
@ -26,4 +25,4 @@ inline cascade_type& operator^= (cascade_type& a, cascade_type b) { return reint
inline bool is_cascade_type_set(const cascade_type source, const cascade_type needle) { return static_cast<int>(source & needle) > 0; }
}
#endif //OOS_CASCADE_TYPE_HPP
#endif //MATADOR_CASCADE_TYPE_HPP

View File

@ -24,14 +24,14 @@ public:
[[nodiscard]] fetch_type fetch() const;
private:
cascade_type cascade_{cascade_type::NONE};
cascade_type cascade_{cascade_type::None};
fetch_type fetch_{fetch_type::Lazy};
};
const foreign_attributes CascadeNoneFetchLazy {};
const foreign_attributes CascadeNoneFetchEager {fetch_type::Eager};
const foreign_attributes CascadeAllFetchLazy {cascade_type::ALL, fetch_type::Lazy};
const foreign_attributes CascadeAllFetchEager {cascade_type::ALL, fetch_type::Eager};
const foreign_attributes CascadeAllFetchLazy {cascade_type::All, fetch_type::Lazy};
const foreign_attributes CascadeAllFetchEager {cascade_type::All, fetch_type::Eager};
}

View File

@ -29,7 +29,7 @@ struct flight {
namespace field = matador::access;
using namespace matador::utils;
field::primary_key(op, "id", id);
field::belongs_to(op, "airplane_id", plane, {utils::cascade_type::ALL, fetch_type::Eager});
field::belongs_to(op, "airplane_id", plane, {utils::cascade_type::All, fetch_type::Eager});
field::attribute(op, "pilot_name", pilot_name, 255);
}
};