entity query and record progress

This commit is contained in:
2024-03-04 20:09:39 +01:00
parent 830185c3c5
commit be610ffcad
31 changed files with 294 additions and 50 deletions
+37
View File
@@ -0,0 +1,37 @@
#ifndef QUERY_FIELD_HPP
#define QUERY_FIELD_HPP
#include "matador/sql/any_type.hpp"
#include "matador/sql/any_type_to_visitor.hpp"
#include <string>
namespace matador::sql {
class field
{
public:
[[nodiscard]] const std::string& name() const;
template<class Type>
Type as() const
{
const Type* ptr= std::get_if<Type>(&value_);
if (ptr) {
return *ptr;
}
any_type_to_visitor<Type> visitor;
std::visit(visitor, const_cast<any_type&>(value_));
return visitor.result;
}
friend std::ostream& operator<<(std::ostream &out, const field &col);
private:
std::string name_;
any_type value_;
};
}
#endif //QUERY_FIELD_HPP