pub struct ODCSImporter { /* private fields */ }Expand description
ODCS parser service for parsing Open Data Contract Standard YAML files. Handles ODCS v3.1.0 (primary format) and legacy ODCL formats (converted to ODCS).
Implementations§
Source§impl ODCSImporter
impl ODCSImporter
Sourcepub fn new() -> ODCSImporter
pub fn new() -> ODCSImporter
Create a new ODCS parser instance.
§Example
use data_modelling_core::import::odcs::ODCSImporter;
let mut importer = ODCSImporter::new();Sourcepub fn import(
&mut self,
yaml_content: &str,
) -> Result<ImportResult, ImportError>
pub fn import( &mut self, yaml_content: &str, ) -> Result<ImportResult, ImportError>
Import ODCS/ODCL YAML content and create Table (SDK interface).
Supports ODCS v3.1.0 (primary), legacy ODCL formats (converted to ODCS), and Liquibase formats.
§Arguments
yaml_content- ODCS/ODCL YAML content as a string
§Returns
An ImportResult containing the extracted table and any parse errors.
§Example
use data_modelling_core::import::odcs::ODCSImporter;
let mut importer = ODCSImporter::new();
let yaml = r#"
apiVersion: v3.1.0
kind: DataContract
id: 550e8400-e29b-41d4-a716-446655440000
version: 1.0.0
name: users
schema:
fields:
- name: id
type: bigint
"#;
let result = importer.import(yaml).unwrap();
assert_eq!(result.tables.len(), 1);Sourcepub fn parse_table(
&mut self,
yaml_content: &str,
) -> Result<(Table, Vec<ParserError>), Error>
pub fn parse_table( &mut self, yaml_content: &str, ) -> Result<(Table, Vec<ParserError>), Error>
Parse ODCS/ODCL YAML content and create Table (public method for native app use).
This method returns the full Table object with all metadata, suitable for use in
native applications that need direct access to the parsed table structure.
For API use, prefer the import() method which returns ImportResult.
§Returns
Returns a tuple of (Table, list of errors/warnings). Errors list is empty if parsing is successful.
Sourcepub fn parse_struct_type_from_string(
&self,
field_name: &str,
type_str: &str,
field_data: &Map<String, Value>,
) -> Result<Vec<Column>, Error>
pub fn parse_struct_type_from_string( &self, field_name: &str, type_str: &str, field_data: &Map<String, Value>, ) -> Result<Vec<Column>, Error>
Parse STRUCT type definition from string (e.g., “ARRAY<STRUCT<ID: STRING, NAME: STRING>>”). Parse STRUCT type from string and create nested columns This is public so it can be used by SQL importer to parse STRUCT types