pub struct ODCSExporter;Expand description
Exporter for ODCS (Open Data Contract Standard) v3.1.0 YAML format.
Implementations§
Source§impl ODCSExporter
impl ODCSExporter
Sourcepub fn export_table(table: &Table, _format: &str) -> String
pub fn export_table(table: &Table, _format: &str) -> String
Export a table to ODCS v3.1.0 YAML format.
Note: Only ODCS v3.1.0 format is supported. Legacy formats have been removed.
§Arguments
table- The table to export_format- Format parameter (ignored, always uses ODCS v3.1.0)
§Returns
A YAML string in ODCS v3.1.0 format.
§Example
use data_modelling_core::export::odcs::ODCSExporter;
use data_modelling_core::models::{Table, Column};
let table = Table::new(
"users".to_string(),
vec![Column::new("id".to_string(), "BIGINT".to_string())],
);
let yaml = ODCSExporter::export_table(&table, "odcs_v3_1_0");
assert!(yaml.contains("apiVersion: v3.1.0"));
assert!(yaml.contains("kind: DataContract"));Sourcepub fn export_contract(contract: &ODCSContract) -> String
pub fn export_contract(contract: &ODCSContract) -> String
Export an ODCSContract directly to YAML format.
This is the preferred v2 API that directly serializes an ODCSContract struct,
preserving all metadata and nested structures without reconstruction.
§Arguments
contract- The ODCSContract to export
§Returns
A YAML string in ODCS v3.1.0 format.
§Example
use data_modelling_core::export::odcs::ODCSExporter;
use data_modelling_core::models::odcs::{ODCSContract, SchemaObject, Property};
let contract = ODCSContract {
api_version: "v3.1.0".to_string(),
kind: "DataContract".to_string(),
id: "my-contract-id".to_string(),
name: "My Contract".to_string(),
version: "1.0.0".to_string(),
status: Some("active".to_string()),
schema: vec![SchemaObject {
name: "users".to_string(),
properties: vec![Property {
name: "id".to_string(),
logical_type: "integer".to_string(),
physical_type: Some("BIGINT".to_string()),
required: true,
primary_key: true,
..Default::default()
}],
..Default::default()
}],
..Default::default()
};
let yaml = ODCSExporter::export_contract(&contract);
assert!(yaml.contains("apiVersion: v3.1.0"));
assert!(yaml.contains("kind: DataContract"));Sourcepub fn export_contract_validated(
contract: &ODCSContract,
) -> Result<String, ExportError>
pub fn export_contract_validated( contract: &ODCSContract, ) -> Result<String, ExportError>
Sourcepub fn export(
&self,
tables: &[Table],
_format: &str,
) -> Result<HashMap<String, ExportResult>, ExportError>
pub fn export( &self, tables: &[Table], _format: &str, ) -> Result<HashMap<String, ExportResult>, ExportError>
Export tables to ODCS v3.1.0 YAML format (SDK interface).
Auto Trait Implementations§
impl Freeze for ODCSExporter
impl RefUnwindSafe for ODCSExporter
impl Send for ODCSExporter
impl Sync for ODCSExporter
impl Unpin for ODCSExporter
impl UnwindSafe for ODCSExporter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more