query preparations for std::optional

This commit is contained in:
2024-01-16 22:09:19 +01:00
parent 92eb30767e
commit 2060883d59
8 changed files with 69 additions and 36 deletions
+30
View File
@@ -0,0 +1,30 @@
#ifndef QUERY_OPTIONAL_HPP
#define QUERY_OPTIONAL_HPP
#include "matador/utils/access.hpp"
#include "matador/utils/field_attributes.hpp"
#include <optional>
#include <string>
namespace matador::test {
struct optional
{
unsigned long id{};
std::optional<std::string> name;
std::optional<unsigned int> age{};
template<class Operator>
void process(Operator &op) {
namespace field = matador::utils::access;
using namespace matador::utils;
field::primary_key(op, "id", id);
field::attribute(op, "name", name, 255);
field::attribute(op, "age", age);
}
};
}
#endif //QUERY_OPTIONAL_HPP