pub trait Validate {
// Required method
fn validate<'c, 'life0, 'life1, 'async_trait, C>(
&'life0 self,
conn: &'life1 mut C,
) -> Pin<Box<dyn Future<Output = Result<(), ValidateError>> + 'async_trait>>
where C: Migrate + 'async_trait,
Self: 'async_trait,
'c: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}
Required Methods§
Sourcefn validate<'c, 'life0, 'life1, 'async_trait, C>(
&'life0 self,
conn: &'life1 mut C,
) -> Pin<Box<dyn Future<Output = Result<(), ValidateError>> + 'async_trait>>where
C: Migrate + 'async_trait,
Self: 'async_trait,
'c: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn validate<'c, 'life0, 'life1, 'async_trait, C>(
&'life0 self,
conn: &'life1 mut C,
) -> Pin<Box<dyn Future<Output = Result<(), ValidateError>> + 'async_trait>>where
C: Migrate + 'async_trait,
Self: 'async_trait,
'c: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Validate previously applied migrations against the migration source.
Depending on the migration source this can be used to check if all migrations
for the current version of the application have been applied.
Use Validator::from_migrator
to use the migrations available during compilation.
§Examples
// Use migrations that were in a local folder during build: ./tests/migrations-1
let v = Validator::from_migrator(sqlx::migrate!("./tests/migrations-1"));
// Create a connection pool
let pool = sqlx_core::sqlite::SqlitePoolOptions::new().connect("sqlite::memory:").await?;
let mut conn = pool.acquire().await?;
// Validate the migrations
v.validate(&mut *conn).await?;
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.