query/include/matador/sql/query_macro.hpp

26 lines
653 B
C++

#ifndef QUERY_QUERY_HELPER_HPP
#define QUERY_QUERY_HELPER_HPP
#include "matador/utils/macro_map.hpp"
#include "matador/query/table.hpp"
#include "matador/query/table_column.hpp"
#include <string>
#include <ostream>
#define FIELD(x) const matador::query::column& x = create_column(*this, #x);
#define QUERY_HELPER(C, V, ...) \
namespace matador::query::meta { \
namespace internal { \
class C##_table : public table { \
public: \
C##_table() : table(#C) {} \
MAP(FIELD, __VA_ARGS__) \
}; } \
static const internal:: C##_table V; \
}
#endif //QUERY_QUERY_HELPER_HPP