renamed class attribute_definition_generator to attribute_generator
This commit is contained in:
+9
-10
@@ -52,18 +52,17 @@ private:
|
||||
utils::basic_type type_{};
|
||||
};
|
||||
|
||||
class attribute_definition_generator final {
|
||||
class attribute_generator final {
|
||||
private:
|
||||
attribute_definition_generator(std::vector<attribute> &columns, const repository &repo);
|
||||
attribute_generator(std::vector<attribute> &columns, const repository &repo);
|
||||
|
||||
public:
|
||||
~attribute_definition_generator() = default;
|
||||
~attribute_generator() = default;
|
||||
|
||||
template < class Type >
|
||||
static std::vector<attribute> generate(const repository &repo)
|
||||
{
|
||||
static std::vector<attribute> generate(const repository &repo) {
|
||||
std::vector<attribute> columns;
|
||||
attribute_definition_generator gen(columns, repo);
|
||||
attribute_generator gen(columns, repo);
|
||||
Type obj;
|
||||
access::process(gen, obj);
|
||||
return columns;
|
||||
@@ -72,7 +71,7 @@ public:
|
||||
template < class Type >
|
||||
static std::vector<attribute> generate(const Type& obj, const repository &repo) {
|
||||
std::vector<attribute> columns;
|
||||
attribute_definition_generator gen(columns, repo);
|
||||
attribute_generator gen(columns, repo);
|
||||
access::process(gen, obj);
|
||||
return columns;
|
||||
}
|
||||
@@ -133,17 +132,17 @@ private:
|
||||
};
|
||||
|
||||
template<typename ValueType>
|
||||
void attribute_definition_generator::on_primary_key(const char *id, ValueType &x, const utils::primary_key_attribute& attr) {
|
||||
void attribute_generator::on_primary_key(const char *id, ValueType &x, const utils::primary_key_attribute& attr) {
|
||||
on_attribute(id, x, { attr.size(), utils::constraints::PRIMARY_KEY });
|
||||
}
|
||||
|
||||
template<typename Type>
|
||||
void attribute_definition_generator::on_attribute(const char *id, Type &x, const utils::field_attributes &attr) {
|
||||
void attribute_generator::on_attribute(const char *id, Type &x, const utils::field_attributes &attr) {
|
||||
columns_.emplace_back(id, utils::data_type_traits<Type>::type(attr.size()), attr, null_option_type::NOT_NULL);
|
||||
}
|
||||
|
||||
template<typename Type>
|
||||
void attribute_definition_generator::on_attribute(const char *id, std::optional<Type> & /*x*/, const utils::field_attributes &attr)
|
||||
void attribute_generator::on_attribute(const char *id, std::optional<Type> & /*x*/, const utils::field_attributes &attr)
|
||||
{
|
||||
columns_.emplace_back(id, utils::data_type_traits<Type>::type(attr.size()), attr, null_option_type::NULLABLE);
|
||||
}
|
||||
@@ -178,7 +178,7 @@ private:
|
||||
private:
|
||||
friend class internal::shadow_repository;
|
||||
friend class repository_node;
|
||||
friend class attribute_definition_generator;
|
||||
friend class attribute_generator;
|
||||
|
||||
std::string name_;
|
||||
std::shared_ptr<repository_node> root_;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef SCHEMA_NODE_HPP
|
||||
#define SCHEMA_NODE_HPP
|
||||
|
||||
#include "matador/object/attribute_definition_generator.hpp"
|
||||
#include "matador/object/attribute_generator.hpp"
|
||||
#include "matador/object/object_info.hpp"
|
||||
#include "matador/object/primary_key_resolver.hpp"
|
||||
|
||||
@@ -23,7 +23,7 @@ public:
|
||||
primary_key_resolver resolver;
|
||||
auto pk_info = resolver.resolve<Type>();
|
||||
auto ref_column = determine_reference_column(typeid(Type), name, pk_info, repo);
|
||||
const auto attributes = attribute_definition_generator::generate<Type>(repo);
|
||||
const auto attributes = attribute_generator::generate<Type>(repo);
|
||||
auto info = std::make_unique<object_info<Type>>(
|
||||
node,
|
||||
attributes,
|
||||
@@ -47,7 +47,7 @@ public:
|
||||
auto obj = creator();
|
||||
auto info = std::make_unique<object_info<Type>>(
|
||||
result.value(),
|
||||
attribute_definition_generator::generate(*obj, repo),
|
||||
attribute_generator::generate(*obj, repo),
|
||||
std::move(creator)
|
||||
);
|
||||
result.value()->info_ = std::move(info);
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
#include "matador/query/intermediates/executable_query.hpp"
|
||||
|
||||
#include "matador/object/attribute_definition_generator.hpp"
|
||||
#include "matador/object/attribute_generator.hpp"
|
||||
|
||||
namespace matador::query {
|
||||
|
||||
@@ -17,7 +17,7 @@ public:
|
||||
executable_query table(const query::table &tab, const std::vector<object::attribute> &columns);
|
||||
template<class Type>
|
||||
executable_query table(const matador::query::table &tab, const object::repository &schema) {
|
||||
return this->table(tab, object::attribute_definition_generator::generate<Type>(schema));
|
||||
return this->table(tab, object::attribute_generator::generate<Type>(schema));
|
||||
}
|
||||
executable_query schema(const std::string &schema_name);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user