You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

44 lines
1.0 KiB

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