1#ifndef LINTEL_POSTGRES_SERIALIZATION_H
2#define LINTEL_POSTGRES_SERIALIZATION_H
17#define IMPLEMENT_SERIALIZE(type, convertToString, convertToValue) \
18 template<> class Serialization<type> \
21 static std::string serialize(const type &value) { return convertToString(value); } \
22 static type deserialize(const std::string &value) { return convertToValue(value); } \
59 [](
const std::
string &
string) -> std::
string {
return string; },
60 [](
const std::string &string) -> std::string {
return string; })
72 static std::string serialize(
const bool &value) {
return value ?
"t" :
"f"; }
73 static bool deserialize(
const std::string &value) {
return value ==
"t"; }
77 std::chrono::sys_time<std::chrono::microseconds>,
78 [](
const std::chrono::sys_time<std::chrono::microseconds> &time) -> std::string {
81 [](
const std::string &
timeString) -> std::chrono::sys_time<std::chrono::microseconds> {
90 static std::string serialize(
const T &value) {
return std::to_string(value); }
91 static T deserialize(
const std::string &value) {
return static_cast<T>(std::stoul(value)); }
Definition Serialization.h:34
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