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.
 
 
 

56 lines
1.4 KiB

  1. #pragma once
  2. #include "order_by.h"
  3. #include "order_by/order_direction.h"
  4. namespace cpphibernate
  5. {
  6. namespace __impl
  7. {
  8. /* order_by_t */
  9. template<typename... T_order_directions>
  10. struct order_by_t
  11. : public tag_modifier
  12. , public tag_equality_comparable<tag_modifier>
  13. {
  14. using order_directions_type = hana::basic_tuple<T_order_directions...>;
  15. order_directions_type order_directions;
  16. };
  17. /* order_by_builder */
  18. template<typename X, typename>
  19. struct order_by_builder
  20. {
  21. template<typename... T_args>
  22. static constexpr decltype(auto) apply(T_args&&...)
  23. { static_assert(sizeof...(T_args) == -1, "Invalid parameters for order_by(...)!"); }
  24. };
  25. template<typename... T_order_directions>
  26. struct order_by_builder<
  27. mp::list<T_order_directions...>,
  28. mp::enable_if_t<mp::is_true_v<is_order_direction_v<mp::decay_t<T_order_directions>>...>>>
  29. {
  30. static constexpr decltype(auto) apply(T_order_directions&&...)
  31. {
  32. using order_by_type = order_by_t<mp::decay_t<T_order_directions>...>;
  33. return order_by_type { };
  34. }
  35. };
  36. }
  37. /* is_order_by_modifier */
  38. template<typename T>
  39. struct is_order_by_modifier
  40. : public mp::is_specialization_of<T, __impl::order_by_t>
  41. { };
  42. }