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