summaryrefslogtreecommitdiff
path: root/lib/helpers.h
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2021-05-24 01:01:30 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2021-05-24 01:01:30 +0100
commit15c1e5566f7ad8448985ca6e52805ceb4ec389a8 (patch)
tree14908b221d01cca00975da84656adcea57898620 /lib/helpers.h
parentMinor tidy up of replStream (diff)
downloadmygrate-15c1e5566f7ad8448985ca6e52805ceb4ec389a8.tar.bz2
mygrate-15c1e5566f7ad8448985ca6e52805ceb4ec389a8.tar.xz
mygrate-15c1e5566f7ad8448985ca6e52805ceb4ec389a8.zip
Basic support for queries with bound parameters
Bit of a reshuffle to make the types not DB specific, add some basic tests over query execution, no selects yet and no validation anything is actually right.
Diffstat (limited to 'lib/helpers.h')
-rw-r--r--lib/helpers.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/helpers.h b/lib/helpers.h
index 3a94ead..a8a630e 100644
--- a/lib/helpers.h
+++ b/lib/helpers.h
@@ -3,6 +3,7 @@
#include <concepts>
#include <cstdint>
+#include <string>
#include <utility>
namespace MyGrate {
@@ -30,6 +31,24 @@ namespace MyGrate {
i /= 100;
return r;
}
+
+ template<typename T>
+ concept Stringable = requires(T a)
+ {
+ {
+ std::to_string(a)
+ } -> std::same_as<std::string>;
+ };
+ template<typename T>
+ concept Viewable = requires(T a)
+ {
+ {
+ a.data()
+ } -> std::convertible_to<const char *>;
+ {
+ a.size()
+ } -> std::integral;
+ };
}
#endif