pub trait Adapter: Queries + 'static {
type Tx: Transaction;
// Required methods
fn begin(&self) -> impl Future<Output = Result<Self::Tx, DbError>> + Send;
fn introspect(
&self,
) -> impl Future<Output = Result<LiveSchema, DbError>> + Send;
fn apply(
&self,
plan: &MigrationPlan,
) -> impl Future<Output = Result<(), DbError>> + Send;
// Provided methods
fn render_sql(&self, plan: &MigrationPlan) -> Result<String, DbError> { ... }
fn session_with_user(
&self,
q: SessionWithUser<'_>,
) -> impl Future<Output = Result<Option<(Row, Row)>, DbError>> + Send { ... }
}Required Associated Types§
type Tx: Transaction
Required Methods§
fn begin(&self) -> impl Future<Output = Result<Self::Tx, DbError>> + Send
Sourcefn introspect(&self) -> impl Future<Output = Result<LiveSchema, DbError>> + Send
fn introspect(&self) -> impl Future<Output = Result<LiveSchema, DbError>> + Send
Reads the live schema for the migrator. Adapters without DDL return Unsupported.
Provided Methods§
Sourcefn render_sql(&self, plan: &MigrationPlan) -> Result<String, DbError>
fn render_sql(&self, plan: &MigrationPlan) -> Result<String, DbError>
Renders a plan as SQL for fastauth generate. Non-SQL adapters return Unsupported.
Sourcefn session_with_user(
&self,
q: SessionWithUser<'_>,
) -> impl Future<Output = Result<Option<(Row, Row)>, DbError>> + Send
fn session_with_user( &self, q: SessionWithUser<'_>, ) -> impl Future<Output = Result<Option<(Row, Row)>, DbError>> + 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".