pub trait SyncTargetAdapter: Send + Sync {
// Required methods
fn ir_type_to_native(&self, ir_type: &IRType) -> String;
fn format_default(&self, default: &IRDefault) -> Option<String>;
fn format_literal(&self, value: &Option<Value>, ir_type: &IRType) -> String;
// Provided methods
fn quote_char(&self) -> char { ... }
fn quote_ident(&self, name: &str) -> String { ... }
fn supports_primary_key(&self) -> bool { ... }
fn auto_increment_keyword(&self) -> Option<&str> { ... }
fn create_table_suffix(&self, ir_table: &IRTable) -> Option<String> { ... }
fn transform_value(
&self,
value: &Option<Value>,
_ir_type: &IRType,
) -> Option<Value> { ... }
}Expand description
Renders IR back into native DDL fragments (used for the target side of a sync).
Required Methods§
Sourcefn ir_type_to_native(&self, ir_type: &IRType) -> String
fn ir_type_to_native(&self, ir_type: &IRType) -> String
Render an IRType as a native DDL type string.
Sourcefn format_default(&self, default: &IRDefault) -> Option<String>
fn format_default(&self, default: &IRDefault) -> Option<String>
Render an IRDefault as the content of a DEFAULT clause.
Return None to omit the clause entirely (e.g. for auto-increment columns
whose default is handled by the database engine).
Provided Methods§
fn quote_char(&self) -> char
fn quote_ident(&self, name: &str) -> String
Sourcefn supports_primary_key(&self) -> bool
fn supports_primary_key(&self) -> bool
Whether the target database supports inline PRIMARY KEY constraints in CREATE TABLE. OLAP engines typically do not.
Sourcefn auto_increment_keyword(&self) -> Option<&str>
fn auto_increment_keyword(&self) -> Option<&str>
Keyword appended after the column type for auto-increment columns.
Return None if the engine uses a different mechanism (e.g. PG SERIAL/IDENTITY).
Sourcefn create_table_suffix(&self, ir_table: &IRTable) -> Option<String>
fn create_table_suffix(&self, ir_table: &IRTable) -> Option<String>
Appended after CREATE TABLE (...) closing paren. Default: use ir_table.table_options if present.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".