#ifndef QUERY_TABLE_REPOSITORY_HPP #define QUERY_TABLE_REPOSITORY_HPP #include "matador/sql/record.hpp" #include #include #include #include namespace matador::sql { struct table_info { std::string name; record prototype; }; class table_repository { public: template const table_info& attach(const std::string &table_name, const record &proto) { return attach(std::type_index(typeid(Type)), table_name, proto); } const table_info& attach(std::type_index ti, const std::string &table_name, const record &proto); const table_info& attach(std::type_index ti, const table_info& table); template std::optional info() { return info(std::type_index(typeid(Type))); } std::optional info(std::type_index ti); template [[nodiscard]] std::pair reference() const { return reference(std::type_index(typeid(Type))); } [[nodiscard]] std::pair reference(const std::type_index &ti) const; private: using repository = std::unordered_map; repository repository_; }; ; } #endif //QUERY_TABLE_REPOSITORY_HPP