1#ifndef LINTEL_SQLITE_SERIALIZATION_H
2#define LINTEL_SQLITE_SERIALIZATION_H
21#define IMPLEMENT_SERIALIZE(type, convertToString, convertToValue) \
22 template<> class Serialization<type> \
25 static std::string serialize(const type &value) { return convertToString(value); } \
26 static type deserialize(const std::string &value) { return convertToValue(value); } \
63 [](
const std::
string &
string) -> std::
string {
return string; },
64 [](
const std::string &string) -> std::string {
return string; })
76 static std::string serialize(
const bool &value) {
return value ?
"t" :
"0"; }
77 static bool deserialize(
const std::string &value) {
return value ==
"t"; }
81 std::chrono::sys_time<std::chrono::microseconds>,
82 [](
const std::chrono::sys_time<std::chrono::microseconds> &time) -> std::string {
85 [](
const std::string &
timeString) -> std::chrono::sys_time<std::chrono::microseconds> {
92 static std::string serialize(
const T &value) {
return std::to_string(value); }
93 static T deserialize(
const std::string &value) {
return static_cast<T>(std::stoul(value)); }
Definition Serialization.h:38
SystemTime parseSystemTime(const std::string &value)
Definition DateTimeFormat.h:126
std::string formatSystemTime(const SystemTime &value, char dateSeparator='-')
Definition DateTimeFormat.h:91
Definition BaseFeature.h:6
constexpr std::string_view type_name()
Definition TypeName.h:9
#define IMPLEMENT_SERIALIZE(type, convertToString, convertToValue)
Definition Serialization.h:17