1#pragma once
2
3#include <DataTypes/DataTypeNumberBase.h>
4
5
6namespace DB
7{
8
9class DataTypeDate final : public DataTypeNumberBase<UInt16>
10{
11public:
12 static constexpr auto family_name = "Date";
13
14 TypeIndex getTypeId() const override { return TypeIndex::Date; }
15 const char * getFamilyName() const override { return family_name; }
16
17 void serializeText(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings &) const override;
18 void deserializeWholeText(IColumn & column, ReadBuffer & istr, const FormatSettings &) const override;
19 void serializeTextEscaped(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings &) const override;
20 void deserializeTextEscaped(IColumn & column, ReadBuffer & istr, const FormatSettings &) const override;
21 void serializeTextQuoted(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings &) const override;
22 void deserializeTextQuoted(IColumn & column, ReadBuffer & istr, const FormatSettings &) const override;
23 void serializeTextJSON(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings &) const override;
24 void deserializeTextJSON(IColumn & column, ReadBuffer & istr, const FormatSettings &) const override;
25 void serializeTextCSV(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings &) const override;
26 void deserializeTextCSV(IColumn & column, ReadBuffer & istr, const FormatSettings & settings) const override;
27 void serializeProtobuf(const IColumn & column, size_t row_num, ProtobufWriter & protobuf, size_t & value_index) const override;
28 void deserializeProtobuf(IColumn & column, ProtobufReader & protobuf, bool allow_add_row, bool & row_added) const override;
29
30 bool canBeUsedAsVersion() const override { return true; }
31 bool canBeInsideNullable() const override { return true; }
32
33 bool equals(const IDataType & rhs) const override;
34};
35
36}
37