data_modelling_sdk/import/
mod.rs1pub mod avro;
11pub mod json_schema;
12pub mod odcs;
13pub mod protobuf;
14pub mod sql;
15
16#[derive(Debug, serde::Serialize, serde::Deserialize)]
22#[must_use = "import results should be processed or errors checked"]
23pub struct ImportResult {
24 pub tables: Vec<TableData>,
26 pub tables_requiring_name: Vec<TableRequiringName>,
28 pub errors: Vec<ImportError>,
30 pub ai_suggestions: Option<Vec<serde_json::Value>>,
32}
33
34#[derive(Debug, thiserror::Error, serde::Serialize, serde::Deserialize)]
36pub enum ImportError {
37 #[error("Parse error: {0}")]
38 ParseError(String),
39 #[error("Validation error: {0}")]
40 ValidationError(String),
41 #[error("IO error: {0}")]
42 IoError(String),
43}
44
45#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
47pub struct TableData {
48 pub table_index: usize,
49 pub name: Option<String>,
50 pub columns: Vec<ColumnData>,
51 }
53
54#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
56pub struct ColumnData {
57 pub name: String,
58 pub data_type: String,
59 pub nullable: bool,
60 pub primary_key: bool,
61}
62
63pub use avro::AvroImporter;
65pub use json_schema::JSONSchemaImporter;
66pub use odcs::ODCSImporter;
67pub use protobuf::ProtobufImporter;
68pub use sql::SQLImporter;
69
70#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
72pub struct TableRequiringName {
73 pub table_index: usize,
74 pub suggested_name: Option<String>,
75}