pub struct AvroExporter;Expand description
Exporter for AVRO schema format.
Implementations§
Source§impl AvroExporter
impl AvroExporter
Sourcepub fn export(&self, tables: &[Table]) -> Result<ExportResult, ExportError>
pub fn export(&self, tables: &[Table]) -> Result<ExportResult, ExportError>
Export tables to AVRO schema format (SDK interface).
§Arguments
tables- Slice of tables to export
§Returns
An ExportResult containing AVRO schema(s) as JSON.
If a single table is provided, returns a single schema object.
If multiple tables are provided, returns an array of schemas.
§Example
use data_modelling_core::export::avro::AvroExporter;
use data_modelling_core::models::{Table, Column};
let tables = vec![
Table::new("User".to_string(), vec![Column::new("id".to_string(), "INT64".to_string())]),
];
let exporter = AvroExporter;
let result = exporter.export(&tables).unwrap();
assert_eq!(result.format, "avro");Sourcepub fn export_table(table: &Table) -> Value
pub fn export_table(table: &Table) -> Value
Export a table to AVRO schema format.
§Arguments
table- The table to export
§Returns
A serde_json::Value representing the AVRO schema for the table.
§Example
use data_modelling_core::export::avro::AvroExporter;
use data_modelling_core::models::{Table, Column};
let table = Table::new(
"User".to_string(),
vec![Column::new("id".to_string(), "INT64".to_string())],
);
let schema = AvroExporter::export_table(&table);
assert_eq!(schema["type"], "record");
assert_eq!(schema["name"], "User");Auto Trait Implementations§
impl Freeze for AvroExporter
impl RefUnwindSafe for AvroExporter
impl Send for AvroExporter
impl Sync for AvroExporter
impl Unpin for AvroExporter
impl UnsafeUnpin for AvroExporter
impl UnwindSafe for AvroExporter
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