mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-05 15:21:43 +00:00
56 lines
729 B
C++
56 lines
729 B
C++
#pragma once
|
|
|
|
#include <string>
|
|
#include <unordered_map>
|
|
|
|
#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
|
|
{
|
|
|
|
|
|
ColumnDefaultType columnDefaultTypeFromString(const std::string & str);
|
|
std::string toString(const ColumnDefaultType type);
|
|
|
|
|
|
struct ColumnDefault
|
|
{
|
|
ColumnDefaultType type;
|
|
ASTPtr expression;
|
|
};
|
|
|
|
|
|
bool operator==(const ColumnDefault & lhs, const ColumnDefault & rhs);
|
|
|
|
|
|
using ColumnDefaults = std::unordered_map<std::string, ColumnDefault>;
|
|
|
|
|
|
}
|