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}
29
30#[derive(Debug, Clone)]
31pub struct TypeInferenceOptions {
32 pub infer_types: bool,
33 pub decimal_comma: bool,
34 pub date_format: Option<String>,
35 pub null_values: Vec<String>,
36 pub true_values: Vec<String>,
37 pub false_values: Vec<String>,
38}
39
40impl Default for TypeInferenceOptions {
41 fn default() -> Self {
42 Self {
43 infer_types: true,
44 decimal_comma: false,
45 date_format: None,
46 null_values: vec![String::new()],
47 true_values: vec!["true".to_owned()],
48 false_values: vec!["false".to_owned()],
49 }
50 }
51}
52
53#[derive(Debug, Clone, PartialEq, Eq)]
54pub enum HeaderCase {
55 Snake,
56 Camel,
57 Pascal,
58 ScreamingSnake,
59}
60
61#[derive(Debug, Clone, Default)]
62pub struct InputNormalizationOptions {
63 pub trim: bool,
64 pub skip_empty_rows: bool,
65 pub normalize_headers: bool,
66 pub header_case: Option<HeaderCase>,
67 pub dedupe_headers: bool,
68}
69
70#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
72pub enum JsonMode {
73 #[default]
77 Array,
78 Object,
82 Flatten,
85}
86
87#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
89pub enum XmlMode {
90 #[default]
95 Rows,
96 Descendants,
100 Attributes,
106}
107
108#[derive(Debug, Clone, Default)]
110pub struct ExtractionOptions {
111 pub json_mode: JsonMode,
112 pub xml_mode: XmlMode,
113}
114
115#[derive(Debug, Clone, PartialEq)]
117pub enum InferredType {
118 Integer,
119 Real,
120 Text,
121 Mixed,
123}
124
125impl InferredType {
126 pub fn as_str(&self) -> &'static str {
127 match self {
128 InferredType::Integer => "INTEGER",
129 InferredType::Real => "REAL",
130 InferredType::Text => "TEXT",
131 InferredType::Mixed => "MIXED",
132 }
133 }
134}
135
136#[derive(Debug, Clone)]
138pub struct ColumnInfo {
139 pub table_name: String,
140 pub column_name: String,
141 pub inferred_type: InferredType,
142 pub nullable: bool,
143}
144
145#[derive(Debug, Clone)]
147pub struct ColumnStats {
148 pub distinct_count: usize,
149 pub min_value: Option<String>,
150 pub max_value: Option<String>,
151}
152
153#[derive(Debug, Clone)]
155pub struct TableSummary {
156 pub table_name: String,
158 pub source_path: String,
160 pub source_selector: Option<String>,
162 pub row_count: usize,
163 pub columns: Vec<ColumnInfo>,
164 pub sample_rows: Vec<Vec<QueryValue>>,
166 pub warnings: Vec<String>,
168 pub column_stats: Option<Vec<ColumnStats>>,
170}