entity query and record progress
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user