pub trait DatabaseBackend:
Debug
+ Send
+ Sync
+ 'static {
// Required methods
fn name(&self) -> &'static str;
fn supports(&self, feature: BackendFeature) -> bool;
fn map_type(&self, ty: SqlType) -> ColumnType;
// Provided method
fn map_column(&self, col: &Column) -> ColumnType { ... }
}Expand description
One umbral-supported relational backend.
Trait surface kept narrow at M4: identity (name), feature queries
(supports), and SQL-type mapping for the migration engine
(map_type). quote_identifier, render_upsert, and dialect-
specific rendering helpers get added when M5’s migration engine and
bulk-insert paths need them; sea-query exposes those via per-backend
QueryBuilder types rather than a single dialect enum, so umbral
dispatches through name() for now and adds typed rendering helpers
when there’s a real consumer.
Required Methods§
Sourcefn name(&self) -> &'static str
fn name(&self) -> &'static str
Stable string identifier. "postgres", "sqlite", etc. Used as
the matching key in FieldSpec::supported_backends, and shown
in system-check error messages.
Sourcefn supports(&self, feature: BackendFeature) -> bool
fn supports(&self, feature: BackendFeature) -> bool
Whether this backend supports the given feature. Used by the
system check to gate Postgres-only field types (Array, HStore,
jsonb) and by the migration engine to choose between
INSERT ... RETURNING and INSERT; last_insert_rowid().
Sourcefn map_type(&self, ty: SqlType) -> ColumnType
fn map_type(&self, ty: SqlType) -> ColumnType
Map an umbral SqlType to the sea-query ColumnType that
renders the right native SQL column type on this backend. The
migration engine (M5) reads this when generating CREATE TABLE.
Provided Methods§
Sourcefn map_column(&self, col: &Column) -> ColumnType
fn map_column(&self, col: &Column) -> ColumnType
Map a full column (type + per-column hints like max_length)
to its sea-query ColumnType. Default impl delegates to
map_type — backends that want to lift hints (Postgres
rendering Text + max_length=N as VARCHAR(N), for example)
override this. The migration engine prefers this over
map_type so the per-column attributes flow into DDL.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".