renamed fetch types to be pascal case

This commit is contained in:
Sascha Kühl
2025-12-08 13:44:53 +01:00
parent 2fcb504b9a
commit 3b0b9615ca
20 changed files with 35 additions and 38 deletions
-1
View File
@@ -36,7 +36,6 @@ private:
std::string name_;
std::variant<class attribute*, std::string> attr_;
// class attribute* attr_{nullptr};
object *owner_{nullptr};
utils::constraints options_{utils::constraints::None};
std::string ref_table_name_{};
-2
View File
@@ -2,9 +2,7 @@
#define MATADOR_OBJECT_HPP
#include "matador/object/attribute.hpp"
// #include "matador/object/attribute_generator.hpp"
#include "matador/object/constraint.hpp"
// #include "matador/object/constraints_generator.hpp"
#include "matador/utils/identifier.hpp"
@@ -113,7 +113,7 @@ public:
template<class ContainerType>
void on_has_many(const char * /*id*/, ContainerType &, const char *join_column, const utils::foreign_attributes &attr) {
if (attr.fetch() == utils::fetch_type::EAGER) {
if (attr.fetch() == utils::fetch_type::Eager) {
const auto result = schema_.basic_info(typeid(typename ContainerType::value_type::value_type));
if (!result) {
throw query_builder_exception{query_build_error::UnknownType};
@@ -143,7 +143,7 @@ public:
template<class ContainerType>
void on_has_many_to_many(const char *id, ContainerType &/*cont*/, const char *join_column, const char *inverse_join_column, const utils::foreign_attributes &attr) {
if (attr.fetch() != utils::fetch_type::EAGER) {
if (attr.fetch() != utils::fetch_type::Eager) {
return;
}
const auto result = schema_.basic_info(typeid(typename ContainerType::value_type::value_type));
@@ -183,7 +183,7 @@ public:
template<class ContainerType>
void on_has_many_to_many(const char *id, ContainerType &/*cont*/, const utils::foreign_attributes &attr) {
if (attr.fetch() != utils::fetch_type::EAGER) {
if (attr.fetch() != utils::fetch_type::Eager) {
return;
}
const auto result = schema_.basic_info(typeid(typename ContainerType::value_type::value_type));
@@ -258,7 +258,7 @@ void session_query_builder::on_foreign_object(const char *id, Pointer &, const u
}
const auto foreign_table = std::make_shared<query::table>(info->get().name(), build_alias('t', ++table_index));
if (attr.fetch() == utils::fetch_type::EAGER) {
if (attr.fetch() == utils::fetch_type::Eager) {
auto next = processed_tables_.find(info->get().name());
if (next != processed_tables_.end()) {
+3 -3
View File
@@ -88,7 +88,7 @@ public:
template<class ContainerType>
void on_has_many(const char * /*id*/, ContainerType &, const char *, const utils::foreign_attributes &attr) {
if (attr.fetch() == utils::fetch_type::LAZY || is_column_generator_option_set(options_, column_generator_options::ForceLazy)) {
if (attr.fetch() == utils::fetch_type::Lazy || is_column_generator_option_set(options_, column_generator_options::ForceLazy)) {
return;
}
if (!repo_) {
@@ -111,7 +111,7 @@ public:
template<class ContainerType>
void on_has_many_to_many(const char * /*id*/, ContainerType & /*cont*/, const char *join_column, const char *inverse_join_column, const utils::foreign_attributes &attr) {
if (attr.fetch() == utils::fetch_type::LAZY || is_column_generator_option_set(options_, column_generator_options::ForceLazy)) {
if (attr.fetch() == utils::fetch_type::Lazy || is_column_generator_option_set(options_, column_generator_options::ForceLazy)) {
return;
}
push(join_column);
@@ -124,7 +124,7 @@ public:
private:
template<class Pointer>
void on_foreign_key(const char *id, Pointer &, const utils::foreign_attributes &attr) {
if (attr.fetch() == utils::fetch_type::LAZY || is_column_generator_option_set(options_, column_generator_options::ForceLazy)) {
if (attr.fetch() == utils::fetch_type::Lazy || is_column_generator_option_set(options_, column_generator_options::ForceLazy)) {
push(id);
} else {
if (!repo_) {
@@ -109,14 +109,14 @@ public:
template<class ContainerType>
void on_has_many_to_many(const char *, ContainerType &, const char * /*join_column*/, const char * /*inverse_join_column*/, const utils::foreign_attributes &attr) {
if (attr.fetch() == utils::fetch_type::LAZY) {
if (attr.fetch() == utils::fetch_type::Lazy) {
} else {}
}
template<class ContainerType>
void on_has_many_to_many(const char *, ContainerType &, const utils::foreign_attributes &attr) {
if (attr.fetch() == utils::fetch_type::LAZY) {
if (attr.fetch() == utils::fetch_type::Lazy) {
} else {}
}
@@ -124,7 +124,7 @@ public:
template<class ContainerType>
void on_has_many(const char * /*id*/, ContainerType &cont, const char * /*join_column*/,
const utils::foreign_attributes &attr) {
if (attr.fetch() == utils::fetch_type::LAZY) {
if (attr.fetch() == utils::fetch_type::Lazy) {
// pk_reader_.read(*id, column_index_++);
} else {
const auto ti = std::type_index(typeid(typename ContainerType::value_type::value_type));
@@ -197,7 +197,7 @@ private:
if (x.empty()) {
x.reset(new typename Pointer::value_type);
}
if (attr.fetch() == utils::fetch_type::LAZY) {
if (attr.fetch() == utils::fetch_type::Lazy) {
pk_reader_.read(*x, column_index_++);
} else {
const auto ti = std::type_index(typeid(*x));
@@ -57,7 +57,7 @@ public:
private:
template<class Type>
void on_foreign_key(const utils::fetch_type fetch) {
if (fetch == utils::fetch_type::LAZY) {
if (fetch == utils::fetch_type::Lazy) {
++column_index_;
} else {
const Type obj;
+3 -4
View File
@@ -10,10 +10,9 @@ namespace matador::utils {
*
* Defines fetch types for foreign relations
*/
enum class fetch_type : uint8_t
{
LAZY, /**< Indicates lazy fetch */
EAGER /**< Indicates eager fetch */
enum class fetch_type : uint8_t {
Lazy, /**< Indicates lazy fetch */
Eager /**< Indicates eager fetch */
};
}
+4 -3
View File
@@ -25,12 +25,13 @@ public:
private:
cascade_type cascade_{cascade_type::NONE};
fetch_type fetch_{fetch_type::LAZY};
fetch_type fetch_{fetch_type::Lazy};
};
const foreign_attributes CascadeNoneFetchLazy {};
const foreign_attributes CascadeAllFetchLazy {cascade_type::ALL, fetch_type::LAZY};
const foreign_attributes CascadeAllFetchEager {cascade_type::ALL, fetch_type::EAGER};
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};
}