Qx v0.7
Qt Extensions Library
Loading...
Searching...
No Matches
qx-sqlconcepts.h
Go to the documentation of this file.
1#ifndef QX_SQLCONCEPTS_H
2#define QX_SQLCONCEPTS_H
3
4// Standard Library Includes
5#include <concepts>
6
7// Qt Includes
8#include <QVariant>
9#include <QSqlQuery>
10
11// Intra-component Includes
12#include "qx/sql/qx-sqlerror.h"
13
14// Extra-component Includes
15#include "qx/utility/qx-stringliteral.h"
16
17namespace QxSql
18{
19
20//-Forwards---------------------------------------------------------------
21template<typename T>
22struct Converter;
23
24template<class Struct, Qx::CStringLiteral member>
25struct MemberOverrideConverter;
26
27template<typename SelfType, typename DelayedSelfType>
28struct QxSqlMetaStructOutside;
29
30//-Concepts--------------------------------------------------------------
31template<typename T>
32concept sql_struct_inside = requires {
33 T::template QxSqlMetaStructInside<T>::memberMetadata();
34};
35
36template<typename T>
37concept sql_struct_outside = requires {
38 QxSqlMetaStructOutside<T, T>::memberMetadata();
39};
40
41template<typename T>
43
44template<typename T>
45concept sql_convertible = requires(T& tValue) {
46 { Converter<T>::fromSql(tValue, QVariant()) } -> std::same_as<Qx::SqlError>;
47 { Converter<T>::toSql(tValue) } -> std::same_as<QVariant>;
48};
49
50template<class K, typename T, Qx::CStringLiteral N>
51concept sql_override_convertible = requires(T& tValue) {
52 { MemberOverrideConverter<K, N>::fromSql(tValue, QVariant()) } -> std::same_as<Qx::SqlError>;
53 { MemberOverrideConverter<K, N>::toSql(tValue) } -> std::same_as<QVariant>;
54};
55
56template<typename Key, class Value>
57concept sql_keyable = requires(const Value& v) {
58 { keygen<Key, Value>(v) } -> std::same_as<Key>;
59};
60
61template<typename T>
64
65template<typename T>
69
70template<typename T>
73
74template<typename T>
77}
78
79#endif // QX_SQLCONCEPTS_H
Specifies that a type is an associative container, the value type of which is convertible,...
Definition qx-sqlconcepts.h:66
Specifies that a type is a non-associative container, the value type of which is convertible to/from ...
Definition qx-sqlconcepts.h:62
Specifies that a type is a container, and abides by the other corresponding restrictions for that kin...
Definition qx-sqlconcepts.h:71
Specifies that a type is generally convertible to/from SQL.
Definition qx-sqlconcepts.h:45
Specifies that a type has a known method for creating a corresponding key.
Definition qx-sqlconcepts.h:57
Specifies that a type is a specialization of std::optional that manages values of a SQL convertible t...
Definition qx-sqlconcepts.h:75
Specifies that a type has override conversions for changing to/from SQL.
Definition qx-sqlconcepts.h:51
Specifies that a type is a SQL-tied struct registered with QX_SQL_STRUCT().
Definition qx-sqlconcepts.h:32
Specifies that a type is a SQL-tied struct registered with QX_SQL_STRUCT_OUTSIDE().
Definition qx-sqlconcepts.h:37
Specifies that a type is a SQL-tied struct.
Definition qx-sqlconcepts.h:42
Specifies that a type is a Qt-based associative container type.
Definition qx-concepts.h:520
Specifies that a type is a Qt-based collection type.
Definition qx-concepts.h:524
Specifies that a type is a specialization of a template.
Definition qx-concepts.h:513
The QxSql namespace contains several utilities that are specific to the SQL module and grouped togeth...
Definition qx-sqlconcepts.dox:10