pub trait Adapter: Queries + 'static {
type Tx: Transaction;
// Required methods
fn begin(&self) -> impl Future<Output = DbResult<Self::Tx>> + Send;
fn introspect(&self) -> impl Future<Output = DbResult<LiveSchema>> + Send;
fn apply(
&self,
plan: &MigrationPlan,
) -> impl Future<Output = DbResult<()>> + Send;
// Provided methods
fn render_sql(&self, plan: &MigrationPlan) -> DbResult<String> { ... }
fn session_with_user(
&self,
q: SessionWithUser<'_>,
) -> impl Future<Output = DbResult<Option<(Row, Row)>>> + Send { ... }
}Required Associated Types§
type Tx: Transaction
Required Methods§
fn begin(&self) -> impl Future<Output = DbResult<Self::Tx>> + Send
Sourcefn introspect(&self) -> impl Future<Output = DbResult<LiveSchema>> + Send
fn introspect(&self) -> impl Future<Output = DbResult<LiveSchema>> + Send
Reads the live schema for the migrator. Adapters without DDL return Unsupported.
Provided Methods§
Sourcefn render_sql(&self, plan: &MigrationPlan) -> DbResult<String>
fn render_sql(&self, plan: &MigrationPlan) -> DbResult<String>
Renders a plan as SQL for fastauth generate. Non-SQL adapters return Unsupported.
Sourcefn session_with_user(
&self,
q: SessionWithUser<'_>,
) -> impl Future<Output = DbResult<Option<(Row, Row)>>> + Send
fn session_with_user( &self, q: SessionWithUser<'_>, ) -> impl Future<Output = DbResult<Option<(Row, Row)>>> + Send
Session plus user in one call. The default does two lookups; SQL adapters override.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".