1#pragma once
2
3#include <Core/Block.h>
4#include <IO/WriteBuffer.h>
5#include <IO/WriteBufferValidUTF8.h>
6#include <Processors/Formats/Impl/JSONRowOutputFormat.h>
7
8
9namespace DB
10{
11
12struct FormatSettings;
13
14/** The stream for outputting data in the JSONCompact format.
15 */
16class JSONCompactRowOutputFormat : public JSONRowOutputFormat
17{
18public:
19 JSONCompactRowOutputFormat(WriteBuffer & out_, const Block & header, FormatFactory::WriteCallback callback, const FormatSettings & settings_);
20
21 String getName() const override { return "JSONCompactRowOutputFormat"; }
22
23 void writeField(const IColumn & column, const IDataType & type, size_t row_num) override;
24 void writeFieldDelimiter() override;
25 void writeRowStartDelimiter() override;
26 void writeRowEndDelimiter() override;
27
28 void writeBeforeTotals() override;
29 void writeAfterTotals() override;
30
31protected:
32 void writeExtremesElement(const char * title, const Columns & columns, size_t row_num) override;
33
34 void writeTotalsField(const IColumn & column, const IDataType & type, size_t row_num) override
35 {
36 return writeField(column, type, row_num);
37 }
38
39 void writeTotalsFieldDelimiter() override;
40
41};
42
43}
44