1use std::path::Path;
2
3#[derive(Debug, Clone, PartialEq)]
4pub enum QueryValue {
5 Null,
6 Integer(i64),
7 Real(f64),
8 Text(String),
9}
10
11#[derive(Debug, Clone, PartialEq)]
12pub struct QueryResult {
13 pub columns: Vec<String>,
14 pub rows: Vec<Vec<QueryValue>>,
15}
16
17#[derive(Debug, Clone, PartialEq)]
18pub struct QueryParam {
19 pub name: String,
20 pub value: QueryValue,
21}
22
23#[derive(Debug, Clone, Copy)]
24pub struct WorkbookInput<'a> {
25 pub path: &'a Path,
26 pub sheet_name: Option<&'a str>,
27 pub table_name: Option<&'a str>,
28 pub explicit_format: Option<&'a str>,
31}
32
33#[derive(Debug, Clone)]
34pub struct TypeInferenceOptions {
35 pub infer_types: bool,
36 pub decimal_comma: bool,
37 pub date_format: Option<String>,
38 pub null_values: Vec<String>,
39 pub true_values: Vec<String>,
40 pub false_values: Vec<String>,
41}
42
43impl Default for TypeInferenceOptions {
44 fn default() -> Self {
45 Self {
46 infer_types: true,
47 decimal_comma: false,
48 date_format: None,
49 null_values: vec![String::new()],
50 true_values: vec!["true".to_owned()],
51 false_values: vec!["false".to_owned()],
52 }
53 }
54}
55
56#[derive(Debug, Clone, PartialEq, Eq)]
57pub enum HeaderCase {
58 Snake,
59 Camel,
60 Pascal,
61 ScreamingSnake,
62}
63
64#[derive(Debug, Clone, Default)]
65pub struct InputNormalizationOptions {
66 pub trim: bool,
67 pub skip_empty_rows: bool,
68 pub normalize_headers: bool,
69 pub header_case: Option<HeaderCase>,
70 pub dedupe_headers: bool,
71}
72
73#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
75pub enum JsonMode {
76 #[default]
80 Array,
81 Object,
85 Flatten,
88}
89
90#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
92pub enum XmlMode {
93 #[default]
98 Rows,
99 Descendants,
103 Attributes,
109}
110
111#[derive(Debug, Clone, Default)]
113pub struct ExtractionOptions {
114 pub json_mode: JsonMode,
115 pub xml_mode: XmlMode,
116}
117
118#[derive(Debug, Clone, PartialEq)]
120pub enum InferredType {
121 Integer,
122 Real,
123 Text,
124 Mixed,
126}
127
128impl InferredType {
129 pub fn as_str(&self) -> &'static str {
130 match self {
131 InferredType::Integer => "INTEGER",
132 InferredType::Real => "REAL",
133 InferredType::Text => "TEXT",
134 InferredType::Mixed => "MIXED",
135 }
136 }
137}
138
139#[derive(Debug, Clone)]
141pub struct ColumnInfo {
142 pub table_name: String,
143 pub column_name: String,
144 pub inferred_type: InferredType,
145 pub nullable: bool,
146}
147
148#[derive(Debug, Clone)]
150pub struct ColumnStats {
151 pub distinct_count: usize,
152 pub min_value: Option<String>,
153 pub max_value: Option<String>,
154}
155
156#[derive(Debug, Clone)]
158pub struct TableSummary {
159 pub table_name: String,
161 pub source_path: String,
163 pub source_selector: Option<String>,
165 pub row_count: usize,
166 pub columns: Vec<ColumnInfo>,
167 pub sample_rows: Vec<Vec<QueryValue>>,
169 pub warnings: Vec<String>,
171 pub column_stats: Option<Vec<ColumnStats>>,
173}