1 | //===----------------------------------------------------------------------===// |
---|---|
2 | // DuckDB |
3 | // |
4 | // duckdb/parser/column_definition.hpp |
5 | // |
6 | // |
7 | //===----------------------------------------------------------------------===// |
8 | |
9 | #pragma once |
10 | |
11 | #include "duckdb/common/common.hpp" |
12 | #include "duckdb/common/types/value.hpp" |
13 | #include "duckdb/parser/parsed_expression.hpp" |
14 | |
15 | namespace duckdb { |
16 | |
17 | //! A column of a table. |
18 | class ColumnDefinition { |
19 | public: |
20 | ColumnDefinition(string name, SQLType type) : name(name), type(type) { |
21 | } |
22 | ColumnDefinition(string name, SQLType type, unique_ptr<ParsedExpression> default_value) |
23 | : name(name), type(type), default_value(move(default_value)) { |
24 | } |
25 | |
26 | //! The name of the entry |
27 | string name; |
28 | //! The index of the column in the table |
29 | idx_t oid; |
30 | //! The type of the column |
31 | SQLType type; |
32 | //! The default value of the column (if any) |
33 | unique_ptr<ParsedExpression> default_value; |
34 | |
35 | public: |
36 | ColumnDefinition Copy(); |
37 | |
38 | void Serialize(Serializer &serializer); |
39 | static ColumnDefinition Deserialize(Deserializer &source); |
40 | }; |
41 | |
42 | } // namespace duckdb |
43 |