lintel 0.2.0
Loading...
Searching...
No Matches
Classes | Namespaces | Macros | Functions
Serialization.h File Reference
#include <chrono>
#include <string>
#include <type_traits>
#include "lintel/core/utils/DateTimeFormat.h"

Go to the source code of this file.

Classes

class  lintel::postgresql::Serialization< T, Enable >
 

Namespaces

namespace  lintel
 
namespace  lintel::postgresql
 

Macros

#define IMPLEMENT_SERIALIZE(type, convertToString, convertToValue)
 

Functions

 lintel::postgresql::IMPLEMENT_SERIALIZE (std::string, [](const std::string &string) -> std::string { return string;}, [](const std::string &string) -> std::string { return string;}) template<> class Serialization< bool >
 
 lintel::postgresql::IMPLEMENT_SERIALIZE (std::chrono::sys_time< std::chrono::microseconds >, [](const std::chrono::sys_time< std::chrono::microseconds > &time) -> std::string { return datetime::formatSystemTime(time);}, [](const std::string &timeString) -> std::chrono::sys_time< std::chrono::microseconds > { return datetime::parseSystemTime(timeString);}) template< typename T > class Serialization< T
 

Macro Definition Documentation

◆ IMPLEMENT_SERIALIZE

#define IMPLEMENT_SERIALIZE (   type,
  convertToString,
  convertToValue 
)
Value:
template<> class Serialization<type> \
{ \
public: \
static std::string serialize(const type &value) { return convertToString(value); } \
static type deserialize(const std::string &value) { return convertToValue(value); } \
};

Macro that generates a full specialization of Serialization for a given type with the provided serialization and deserialization lambdas or functions.

Parameters
typethe type to specialize for
convertToStringexpression/lambda to convert the type to std::string
convertToValueexpression/lambda to convert std::string to the type