diff --git a/include/matador/orm/schema.hpp b/include/matador/orm/schema.hpp new file mode 100644 index 0000000..2a68acb --- /dev/null +++ b/include/matador/orm/schema.hpp @@ -0,0 +1,27 @@ +#ifndef MATADOR_SCHEMA_HPP +#define MATADOR_SCHEMA_HPP + +#include "matador/object/repository.hpp" + +namespace matador::orm { + +class schema { +public: + explicit schema(const std::string &name); + + template + [[nodiscard]] utils::result attach(const std::string &name, const std::string &parent = "") { + return repo_.attach(name, parent); + } + + template + [[nodiscard]] utils::result attach(const std::string &name) { + return repo_.attach(name); + } + +private: + object::repository repo_; +}; + +} +#endif //MATADOR_SCHEMA_HPP \ No newline at end of file diff --git a/source/orm/CMakeLists.txt b/source/orm/CMakeLists.txt index 6706f7c..9725edc 100644 --- a/source/orm/CMakeLists.txt +++ b/source/orm/CMakeLists.txt @@ -1,5 +1,6 @@ add_library(matador-orm STATIC ../../include/matador/orm/error_code.hpp + ../../include/matador/orm/schema.hpp ../../include/matador/orm/session.hpp ../../include/matador/orm/session_insert_builder.hpp ../../include/matador/orm/session_query_builder.hpp @@ -71,6 +72,7 @@ add_library(matador-orm STATIC ../../include/matador/sql/table.hpp orm/error_code.cpp orm/query_builder_exception.cpp + orm/schema.cpp orm/session.cpp orm/session_insert_builder.cpp orm/session_query_builder.cpp diff --git a/source/orm/orm/schema.cpp b/source/orm/orm/schema.cpp new file mode 100644 index 0000000..b436ed1 --- /dev/null +++ b/source/orm/orm/schema.cpp @@ -0,0 +1,6 @@ +#include "matador/orm/schema.hpp" + +namespace matador::orm { +schema::schema( const std::string& name ) +: repo_(name){} +}