builder progress (attribute, object and constraint class in todo.md)
This commit is contained in:
@@ -93,6 +93,23 @@ private:
|
||||
std::shared_ptr<attribute> reference_column_;
|
||||
};
|
||||
|
||||
|
||||
class object {
|
||||
public:
|
||||
using iterator = std::vector<attribute>::iterator;
|
||||
using const_iterator = std::vector<attribute>::const_iterator;
|
||||
|
||||
private:
|
||||
std::vector<attribute> columns_;
|
||||
std::string name_;
|
||||
std::string alias_;
|
||||
};
|
||||
|
||||
class constraint {
|
||||
public:
|
||||
private:
|
||||
std::shared_ptr<attribute> column_;
|
||||
};
|
||||
/**
|
||||
* User defined literal to have a shortcut creating a column object
|
||||
* @param name Name of the column
|
||||
|
||||
@@ -18,9 +18,9 @@ private:
|
||||
using node_ptr = std::shared_ptr<repository_node>;
|
||||
|
||||
public:
|
||||
explicit shadow_repository(object::repository& s);
|
||||
explicit shadow_repository(repository& s);
|
||||
|
||||
[[nodiscard]] object::repository& repo() const;
|
||||
[[nodiscard]] repository& repo() const;
|
||||
[[nodiscard]] bool contains(const std::type_index& ti) const;
|
||||
[[nodiscard]] utils::result<node_ptr, utils::error> find_node(const std::type_index &type_index) const;
|
||||
[[nodiscard]] utils::result<node_ptr, utils::error> find_node(const std::string &name) const;
|
||||
@@ -28,7 +28,7 @@ public:
|
||||
[[nodiscard]] utils::result<void, utils::error> detach_node(const std::shared_ptr<repository_node> &node) const;
|
||||
|
||||
private:
|
||||
object::repository& schema_;
|
||||
repository& repo_;
|
||||
};
|
||||
}
|
||||
#endif //SHADOW_SCHEMA_HPP
|
||||
|
||||
@@ -18,7 +18,7 @@ public:
|
||||
|
||||
template < typename Type >
|
||||
static std::shared_ptr<repository_node> make_node(repository& repo, const std::string& name) {
|
||||
auto node = std::shared_ptr<repository_node>(new repository_node(repo, name, typeid(Type)));
|
||||
auto node = std::make_shared<repository_node>( repo, name, typeid( Type ) );
|
||||
|
||||
primary_key_resolver resolver;
|
||||
auto pk_info = resolver.resolve<Type>();
|
||||
@@ -74,7 +74,7 @@ public:
|
||||
void update_name(const std::string& name);
|
||||
|
||||
template <typename Type>
|
||||
object_info_ref<Type> info() const {
|
||||
[[nodiscard]] object_info_ref<Type> info() const {
|
||||
return std::ref(static_cast<const object_info<Type>&>(*info_));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user