mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-27 18:12:02 +00:00
37 lines
778 B
C++
37 lines
778 B
C++
#pragma once
|
||
|
||
#include <DB/Core/Block.h>
|
||
#include <DB/IO/WriteBuffer.h>
|
||
#include <DB/DataStreams/IRowOutputStream.h>
|
||
|
||
|
||
namespace DB
|
||
{
|
||
|
||
/** Поток для вывода данных в формате JSON, по объекту на каждую строчку.
|
||
* Не валидирует UTF-8.
|
||
*/
|
||
class JSONEachRowRowOutputStream : public IRowOutputStream
|
||
{
|
||
public:
|
||
JSONEachRowRowOutputStream(WriteBuffer & ostr_, const Block & sample);
|
||
|
||
void writeField(const IColumn & column, const IDataType & type, size_t row_num) override;
|
||
void writeFieldDelimiter() override;
|
||
void writeRowStartDelimiter() override;
|
||
void writeRowEndDelimiter() override;
|
||
|
||
void flush() override
|
||
{
|
||
ostr.next();
|
||
}
|
||
|
||
private:
|
||
WriteBuffer & ostr;
|
||
size_t field_number = 0;
|
||
Names fields;
|
||
};
|
||
|
||
}
|
||
|