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 dataflow;
13pub mod json_schema;
14pub mod odcs;
15#[cfg(feature = "png-export")]
16pub mod png;
17pub mod protobuf;
18pub mod sql;
19
20// anyhow::Result not currently used in this module
21
22/// Result of an export operation.
23///
24/// Contains the exported content and format identifier.
25#[derive(Debug, serde::Serialize, serde::Deserialize)]
26#[must_use = "export results contain the exported content and should be used"]
27pub struct ExportResult {
28    /// Exported content (as string - binary formats will be base64 encoded)
29    pub content: String,
30    /// Format identifier
31    pub format: String,
32}
33
34/// Error during export
35#[derive(Debug, thiserror::Error, serde::Serialize, serde::Deserialize)]
36pub enum ExportError {
37    #[error("Serialization error: {0}")]
38    SerializationError(String),
39    #[error("Validation error: {0}")]
40    ValidationError(String),
41    #[error("IO error: {0}")]
42    IoError(String),
43    #[error("Export error: {0}")]
44    ExportError(String),
45}
46
47impl From<Box<dyn std::error::Error>> for ExportError {
48    fn from(err: Box<dyn std::error::Error>) -> Self {
49        ExportError::ExportError(err.to_string())
50    }
51}
52
53// Re-export for convenience
54pub use avro::AvroExporter;
55pub use json_schema::JSONSchemaExporter;
56pub use odcs::ODCSExporter;
57#[cfg(feature = "png-export")]
58pub use png::PNGExporter;
59pub use protobuf::ProtobufExporter;
60pub use sql::SQLExporter;