summaryrefslogtreecommitdiff
path: root/lib/dbTypes.h
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2021-08-08 12:48:37 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2021-08-08 16:15:07 +0100
commit5378ffd0aca410c50887fee57899776e62bfb766 (patch)
tree699e11a5b6cfcf7f6d2c29083ec84c7ed3fe36c5 /lib/dbTypes.h
parentCreate indexes and keys after copying table data (diff)
downloadmygrate-5378ffd0aca410c50887fee57899776e62bfb766.tar.bz2
mygrate-5378ffd0aca410c50887fee57899776e62bfb766.tar.xz
mygrate-5378ffd0aca410c50887fee57899776e62bfb766.zip
Extract WritePqCopyStrm into its own file
Diffstat (limited to 'lib/dbTypes.h')
-rw-r--r--lib/dbTypes.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/lib/dbTypes.h b/lib/dbTypes.h
index 0b7185c..42b242b 100644
--- a/lib/dbTypes.h
+++ b/lib/dbTypes.h
@@ -11,6 +11,38 @@
struct timespec;
namespace MyGrate {
+ template<typename T> struct printer;
+ template<> struct printer<double> {
+ constexpr static const char * const fmt {"%f"};
+ };
+ template<> struct printer<float> {
+ constexpr static const char * const fmt {"%f"};
+ };
+ template<> struct printer<int8_t> {
+ constexpr static const char * const fmt {"%hhd"};
+ };
+ template<> struct printer<uint8_t> {
+ constexpr static const char * const fmt {"%hhu"};
+ };
+ template<> struct printer<int16_t> {
+ constexpr static const char * const fmt {"%hd"};
+ };
+ template<> struct printer<uint16_t> {
+ constexpr static const char * const fmt {"%hu"};
+ };
+ template<> struct printer<int32_t> {
+ constexpr static const char * const fmt {"%d"};
+ };
+ template<> struct printer<uint32_t> {
+ constexpr static const char * const fmt {"%u"};
+ };
+ template<> struct printer<int64_t> {
+ constexpr static const char * const fmt {"%ld"};
+ };
+ template<> struct printer<uint64_t> {
+ constexpr static const char * const fmt {"%lu"};
+ };
+
struct Date {
inline Date() { }
inline Date(uint16_t y, uint8_t m, uint8_t d) : year {y}, month {m}, day {d} { }