clickhouse_format/output/
mod.rs1use crate::format_name::FormatName;
2
3#[cfg(feature = "with-tsv")]
5pub mod tsv;
6#[cfg(feature = "with-tsv")]
7pub mod tsv_raw;
8#[cfg(feature = "with-tsv")]
9pub mod tsv_with_names;
10#[cfg(feature = "with-tsv")]
11pub mod tsv_with_names_and_types;
12
13#[cfg(feature = "with-tsv")]
14pub use self::{
15 tsv::TsvOutput, tsv_raw::TsvRawOutput, tsv_with_names::TsvWithNamesOutput,
16 tsv_with_names_and_types::TsvWithNamesAndTypesOutput,
17};
18
19#[cfg(feature = "with-tsv")]
20pub type TabSeparatedOutput<T> = self::tsv::TsvOutput<T>;
21#[cfg(feature = "with-tsv")]
22pub type TabSeparatedRawOutput<T> = self::tsv_raw::TsvRawOutput<T>;
23#[cfg(feature = "with-tsv")]
24pub type TabSeparatedWithNamesOutput<T> = self::tsv_with_names::TsvWithNamesOutput<T>;
25#[cfg(feature = "with-tsv")]
26pub type TabSeparatedWithNamesAndTypesOutput<T> =
27 self::tsv_with_names_and_types::TsvWithNamesAndTypesOutput<T>;
28
29#[cfg(feature = "with-json")]
31pub mod json;
32#[cfg(feature = "with-json")]
33pub mod json_compact;
34#[cfg(feature = "with-json")]
35pub mod json_compact_strings;
36#[cfg(feature = "with-json")]
37pub mod json_strings;
38
39#[cfg(feature = "with-json")]
40pub use self::{
41 json::{GeneralJsonOutput, JsonOutput},
42 json_compact::{GeneralJsonCompactOutput, JsonCompactOutput},
43 json_compact_strings::{GeneralJsonCompactStringsOutput, JsonCompactStringsOutput},
44 json_strings::{GeneralJsonStringsOutput, JsonStringsOutput},
45};
46
47#[cfg(feature = "with-json")]
49pub mod json_compact_each_row;
50#[cfg(feature = "with-json")]
51pub mod json_compact_each_row_with_names_and_types;
52#[cfg(feature = "with-json")]
53pub mod json_compact_strings_each_row;
54#[cfg(feature = "with-json")]
55pub mod json_compact_strings_each_row_with_names_and_types;
56#[cfg(feature = "with-json")]
57pub mod json_each_row;
58#[cfg(feature = "with-json")]
59pub mod json_each_row_with_progress;
60#[cfg(feature = "with-json")]
61pub mod json_strings_each_row;
62#[cfg(feature = "with-json")]
63pub mod json_strings_each_row_with_progress;
64
65#[cfg(feature = "with-json")]
66pub use self::{
67 json_compact_each_row::{GeneralJsonCompactEachRowOutput, JsonCompactEachRowOutput},
68 json_compact_each_row_with_names_and_types::{
69 GeneralJsonCompactEachRowWithNamesAndTypesOutput, JsonCompactEachRowWithNamesAndTypesOutput,
70 },
71 json_compact_strings_each_row::{
72 GeneralJsonCompactStringsEachRowOutput, JsonCompactStringsEachRowOutput,
73 },
74 json_compact_strings_each_row_with_names_and_types::{
75 GeneralJsonCompactStringsEachRowWithNamesAndTypesOutput,
76 JsonCompactStringsEachRowWithNamesAndTypesOutput,
77 },
78 json_each_row::{GeneralJsonEachRowOutput, JsonEachRowOutput},
79 json_each_row_with_progress::{
80 GeneralJsonEachRowWithProgressOutput, JsonEachRowWithProgressOutput,
81 },
82 json_strings_each_row::{GeneralJsonStringsEachRowOutput, JsonStringsEachRowOutput},
83 json_strings_each_row_with_progress::{
84 GeneralJsonStringsEachRowWithProgressOutput, JsonStringsEachRowWithProgressOutput,
85 },
86};
87
88pub trait Output {
89 type Row;
90 type Info;
91 type Error: std::error::Error;
92
93 fn format_name() -> FormatName;
94 fn deserialize(&self, slice: &[u8]) -> OutputResult<Self::Row, Self::Info, Self::Error>;
95}
96pub type OutputResult<Row, Info, Error> = Result<(Vec<Row>, Info), Error>;