This repository has been archived by the owner on Jan 3, 2024. It is now read-only.
forked from fnc12/sqlite_orm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathalias_traits.h
51 lines (38 loc) · 1.79 KB
/
alias_traits.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#pragma once
#include <type_traits> // std::remove_const, std::is_base_of, std::is_same
#include "functional/cxx_universal.h"
#include "functional/cxx_type_traits_polyfill.h"
#include "type_traits.h"
namespace sqlite_orm {
/** @short Base class for a custom table alias, column alias or expression alias.
*/
struct alias_tag {};
namespace internal {
template<class A>
SQLITE_ORM_INLINE_VAR constexpr bool is_alias_v = std::is_base_of<alias_tag, A>::value;
template<class A>
using is_alias = polyfill::bool_constant<is_alias_v<A>>;
/** @short Alias of a column in a record set, see `orm_column_alias`.
*/
template<class A>
SQLITE_ORM_INLINE_VAR constexpr bool is_column_alias_v =
polyfill::conjunction_v<is_alias<A>, polyfill::negation<polyfill::is_detected<type_t, A>>>;
template<class A>
using is_column_alias = is_alias<A>;
/** @short Alias of any type of record set, see `orm_recordset_alias`.
*/
template<class A>
SQLITE_ORM_INLINE_VAR constexpr bool is_recordset_alias_v =
polyfill::conjunction_v<is_alias<A>, polyfill::is_detected<type_t, A>>;
template<class A>
using is_recordset_alias = polyfill::bool_constant<is_recordset_alias_v<A>>;
/** @short Alias of a concrete table, see `orm_table_alias`.
*/
template<class A>
SQLITE_ORM_INLINE_VAR constexpr bool is_table_alias_v = polyfill::conjunction_v<
is_recordset_alias<A>,
polyfill::negation<std::is_same<polyfill::detected_t<type_t, A>, std::remove_const_t<A>>>>;
template<class A>
using is_table_alias = polyfill::bool_constant<is_table_alias_v<A>>;
}
}