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.
 
 
 

49 lines
1.1 KiB

  1. #pragma once
  2. #include "key_properties.h"
  3. namespace cpphibernate {
  4. namespace mariadb {
  5. /* key_properties */
  6. template<>
  7. struct key_properties<uuid, void>
  8. {
  9. using key_type = uuid;
  10. static bool is_default(const key_type& key)
  11. { return key == key_type(); }
  12. static constexpr bool is_auto_generated()
  13. { return false; }
  14. static constexpr const char * create_table_argument()
  15. { return nullptr; }
  16. static constexpr const char * create_key_query()
  17. { return "SELECT Uuid()"; }
  18. };
  19. template<typename T_key>
  20. struct key_properties<
  21. T_key,
  22. mp::enable_if_t<mp::is_integral_v<mp::decay_t<T_key>>>>
  23. {
  24. using key_type = mp::decay_t<T_key>;
  25. static bool is_default(const key_type& key)
  26. { return key == key_type(); }
  27. static constexpr bool is_auto_generated()
  28. { return true; }
  29. static constexpr const char * create_table_argument()
  30. { return "AUTO_INCREMENT"; }
  31. static constexpr const char * create_key_query()
  32. { return nullptr; }
  33. };
  34. } }