data_modelling_sdk/export/
mod.rs

1//! Export functionality
2//!
3//! Provides exporters for various formats:
4//! - SQL
5//! - JSON Schema
6//! - AVRO
7//! - Protobuf
8//! - ODCS (Open Data Contract Standard) v3.1.0
9//! - PNG
10
11pub mod avro;
12pub mod json_schema;
13pub mod odcs;
14#[cfg(feature = "png-export")]
15pub mod png;
16pub mod protobuf;
17pub mod sql;
18
19// anyhow::Result not currently used in this module
20
21/// Result of an export operation.
22///
23/// Contains the exported content and format identifier.
24#[derive(Debug)]
25#[must_use = "export results contain the exported content and should be used"]
26pub struct ExportResult {
27    /// Exported content (as string - binary formats will be base64 encoded)
28    pub content: String,
29    /// Format identifier
30    pub format: String,
31}
32
33/// Error during export
34#[derive(Debug, thiserror::Error)]
35pub enum ExportError {
36    #[error("Serialization error: {0}")]
37    SerializationError(String),
38    #[error("Validation error: {0}")]
39    ValidationError(String),
40    #[error("IO error: {0}")]
41    IoError(String),
42    #[error("Export error: {0}")]
43    ExportError(String),
44}
45
46impl From<Box<dyn std::error::Error>> for ExportError {
47    fn from(err: Box<dyn std::error::Error>) -> Self {
48        ExportError::ExportError(err.to_string())
49    }
50}
51
52// Re-export for convenience
53pub use avro::AvroExporter;
54pub use json_schema::JSONSchemaExporter;
55pub use odcs::ODCSExporter;
56#[cfg(feature = "png-export")]
57pub use png::PNGExporter;
58pub use protobuf::ProtobufExporter;
59pub use sql::SQLExporter;