25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

45 lines
1.0 KiB

  1. #pragma once
  2. #include "schema.h"
  3. #include <cpphibernate/types.inl>
  4. #include "../tables/tables.inl"
  5. namespace cpphibernate {
  6. namespace mariadb {
  7. /* schema_t */
  8. template<typename T_schema>
  9. schema_t::schema_t(const T_schema& p_schema)
  10. : name (p_schema.name)
  11. , tables(make_tables(*this, p_schema))
  12. { init(); }
  13. namespace __impl
  14. {
  15. /* schema_builder */
  16. template<typename T, typename>
  17. struct schema_builder
  18. {
  19. template<typename... T_args>
  20. static constexpr decltype(auto) apply(T_args&&... args)
  21. { static_assert(sizeof...(args) == -1, "Invalid parameters for mariadb::make_schema(...)!"); }
  22. };
  23. template<typename T_schema>
  24. struct schema_builder<
  25. mp::list<T_schema>,
  26. mp::enable_if_t<
  27. schema::is_schema_v<mp::decay_t<T_schema>>>>
  28. {
  29. static decltype(auto) apply(const T_schema& p_schema)
  30. { return std::make_unique<schema_t>(p_schema); }
  31. };
  32. }
  33. } }