pub enum Dialect {
Postgres,
Sqlite,
Mysql,
}Expand description
Database dialect selection and dialect-specific behavior.
Type catalogs under each dialect are intentionally incomplete and frequently updated.
data_types.rs lists native built-in types, aliases, and canonicalization rules;
extension_types.rs lists popular extension or externally provided types. These
catalogs exist for deterministic canonicalization, typo suggestions, and helpful
prompts. They are not a claim that Gaman knows the full database type universe.
Unknown types must not be rejected solely because they are absent from these catalogs;
migration history and explicit user decisions are the project-local trust boundary.
New dialect implementations must keep native data types and extension/popular
external types in separate files following this layout.
Variants§
Implementations§
Source§impl Dialect
impl Dialect
Sourcepub fn parse(value: &str) -> Option<Self>
pub fn parse(value: &str) -> Option<Self>
Parses a dialect name such as postgres, postgresql, sqlite, sqlite3, mysql, or mariadb.
Sourcepub fn parse_from_url(database_url: &str) -> Result<Self, DialectParseError>
pub fn parse_from_url(database_url: &str) -> Result<Self, DialectParseError>
Infers the dialect from a database URL scheme.
This accepts normal URL forms such as postgres://..., postgresql://...,
sqlite://..., mysql://..., and mariadb://..., plus SQLx’s SQLite
shorthand such as sqlite::memory:.
Sourcepub fn reorder(
&self,
ops: Vec<Operation>,
previous: &Schema,
current: &Schema,
) -> Vec<Operation>
pub fn reorder( &self, ops: Vec<Operation>, previous: &Schema, current: &Schema, ) -> Vec<Operation>
Reorders operations to satisfy database-specific execution constraints. The default is a no-op — only databases with ordering requirements need to override. Called once per migration after diffing, before SQL generation or writing.
Sourcepub fn should_merge(&self, _table_name: &str, _op: &Operation) -> bool
pub fn should_merge(&self, _table_name: &str, _op: &Operation) -> bool
Whether a decomposed sub-entity op should be folded back into its parent CreateTable. Postgres can inline everything; other dialects (e.g. SQLite) may need FKs kept inline while indexes stay separate.
pub fn normalize_type<'a>(&self, t: &'a str) -> &'a str
pub fn canonical_type(&self, t: &str) -> String
pub fn is_catalog_type(&self, t: &str) -> bool
pub fn type_suggestions(&self, t: &str) -> Vec<String>
pub fn validate_schema( &self, schema: &Schema, ) -> Result<(), SchemaValidationError>
Sourcepub fn normalize_inspected_schema(
&self,
schema: Schema,
) -> Result<Schema, SchemaValidationError>
pub fn normalize_inspected_schema( &self, schema: Schema, ) -> Result<Schema, SchemaValidationError>
Normalizes a live inspected schema before semantic drift comparison.
Sourcepub fn drift_contract(&self) -> &'static [DriftPropertyDoc]
pub fn drift_contract(&self) -> &'static [DriftPropertyDoc]
Returns the documented semantic drift properties for this dialect.
pub fn validate_migration(&self, m: &Migration) -> Result<(), DialectError>
Trait Implementations§
impl Copy for Dialect
impl Eq for Dialect
impl StructuralPartialEq for Dialect
Auto Trait Implementations§
impl Freeze for Dialect
impl RefUnwindSafe for Dialect
impl Send for Dialect
impl Sync for Dialect
impl Unpin for Dialect
impl UnsafeUnpin for Dialect
impl UnwindSafe for Dialect
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.