ClickHouse/dbms/include/DB/Storages/ColumnDefault.h

56 lines
729 B
C++
Raw Normal View History

#pragma once
2016-12-12 07:24:56 +00:00
#include <string>
#include <unordered_map>
2016-12-12 07:24:56 +00:00
#include <DB/Parsers/IAST.h>
namespace DB
{
enum class ColumnDefaultType
{
Default,
Materialized,
Alias
};
}
namespace std
{
template<> struct hash<DB::ColumnDefaultType>
{
size_t operator()(const DB::ColumnDefaultType type) const
{
return hash<int>{}(static_cast<int>(type));
}
};
}
namespace DB
{
2016-12-12 07:24:56 +00:00
ColumnDefaultType columnDefaultTypeFromString(const std::string & str);
std::string toString(const ColumnDefaultType type);
struct ColumnDefault
{
ColumnDefaultType type;
ASTPtr expression;
};
2016-12-12 07:24:56 +00:00
bool operator==(const ColumnDefault & lhs, const ColumnDefault & rhs);
2016-12-12 07:24:56 +00:00
using ColumnDefaults = std::unordered_map<std::string, ColumnDefault>;
2014-10-23 12:16:24 +00:00
}