Struct sql_migration_tests::test_api::TestApi
source · pub struct TestApi {
pub connector: SqlSchemaConnector,
/* private fields */
}
Fields§
§connector: SqlSchemaConnector
Implementations§
source§impl TestApi
impl TestApi
sourcepub fn new(args: TestApiArgs) -> Self
pub fn new(args: TestApiArgs) -> Self
Initializer, called by the test macros.
pub fn args(&self) -> &TestApiArgs
sourcepub fn apply_migrations<'a>(
&'a mut self,
migrations_directory: &'a TempDir
) -> ApplyMigrations<'a>
pub fn apply_migrations<'a>( &'a mut self, migrations_directory: &'a TempDir ) -> ApplyMigrations<'a>
Plan an applyMigrations
command
pub fn connection_string(&self) -> &str
pub fn connection_info(&self) -> ConnectionInfo
pub fn ensure_connection_validity(&mut self) -> ConnectorResult<()>
pub fn schema_name(&self) -> String
sourcepub fn create_migration<'a>(
&'a mut self,
name: &'a str,
schema: &'a str,
migrations_directory: &'a TempDir
) -> CreateMigration<'a>
pub fn create_migration<'a>( &'a mut self, name: &'a str, schema: &'a str, migrations_directory: &'a TempDir ) -> CreateMigration<'a>
Plan a createMigration
command
sourcepub fn create_migrations_directory(&self) -> TempDir
pub fn create_migrations_directory(&self) -> TempDir
Create a temporary directory to serve as a test migrations directory.
sourcepub fn dev_diagnostic<'a>(
&'a mut self,
migrations_directory: &'a TempDir
) -> DevDiagnostic<'a>
pub fn dev_diagnostic<'a>( &'a mut self, migrations_directory: &'a TempDir ) -> DevDiagnostic<'a>
Builder and assertions to call the devDiagnostic
command.
pub fn diagnose_migration_history<'a>( &'a mut self, migrations_directory: &'a TempDir ) -> DiagnoseMigrationHistory<'a>
pub fn diff(&self, params: DiffParams) -> ConnectorResult<DiffResult>
pub fn dump_table(&mut self, table_name: &str) -> ResultSet
pub fn evaluate_data_loss<'a>( &'a mut self, migrations_directory: &'a TempDir, schema: String ) -> EvaluateDataLoss<'a>
sourcepub fn is_mariadb(&self) -> bool
pub fn is_mariadb(&self) -> bool
Returns true only when testing on MariaDB.
sourcepub fn is_mysql_mariadb(&self) -> bool
pub fn is_mysql_mariadb(&self) -> bool
Returns true only when testing on MariaDB.
sourcepub fn is_mysql_5_6(&self) -> bool
pub fn is_mysql_5_6(&self) -> bool
Returns true only when testing on MySQL 5.6.
sourcepub fn is_mysql_8(&self) -> bool
pub fn is_mysql_8(&self) -> bool
Returns true only when testing on MySQL 8.
sourcepub fn is_postgres(&self) -> bool
pub fn is_postgres(&self) -> bool
Returns true only when testing on postgres.
sourcepub fn is_postgres_15(&self) -> bool
pub fn is_postgres_15(&self) -> bool
Returns true only when testing on postgres version 15.
sourcepub fn is_postgres_16(&self) -> bool
pub fn is_postgres_16(&self) -> bool
Returns true only when testing on postgres version 16.
sourcepub fn is_cockroach(&self) -> bool
pub fn is_cockroach(&self) -> bool
Returns true only when testing on cockroach.
sourcepub fn max_ddl_refresh_delay(&self) -> Option<Duration>
pub fn max_ddl_refresh_delay(&self) -> Option<Duration>
Returns a duration that is guaranteed to be larger than the maximum refresh rate after a DDL statement
sourcepub fn insert<'a>(&'a mut self, table_name: &'a str) -> SingleRowInsert<'a>
pub fn insert<'a>(&'a mut self, table_name: &'a str) -> SingleRowInsert<'a>
Insert test values
pub fn list_migration_directories<'a>( &'a mut self, migrations_directory: &'a TempDir ) -> ListMigrationDirectories<'a>
pub fn lower_cases_table_names(&self) -> bool
pub fn mark_migration_applied<'a>( &'a mut self, migration_name: impl Into<String>, migrations_directory: &'a TempDir ) -> MarkMigrationApplied<'a>
pub fn mark_migration_rolled_back( &mut self, migration_name: impl Into<String> ) -> MarkMigrationRolledBack<'_>
pub fn migration_persistence<'a>( &'a mut self ) -> &mut (dyn MigrationPersistence + 'a)
sourcepub fn assert_schema(&mut self) -> SchemaAssertion
pub fn assert_schema(&mut self) -> SchemaAssertion
Assert facts about the database schema
pub fn assert_schema_with_namespaces( &mut self, namespaces: Option<Namespaces> ) -> SchemaAssertion
sourcepub fn datasource_block(&self) -> DatasourceBlock<'_>
pub fn datasource_block(&self) -> DatasourceBlock<'_>
Render a valid datasource block, including database URL.
pub fn datasource_block_with<'a>( &'a self, params: &'a [(&'a str, &'a str)] ) -> DatasourceBlock<'a>
sourcepub fn connector_diff(
&mut self,
from: DiffTarget<'_>,
to: DiffTarget<'_>,
namespaces: Option<Namespaces>
) -> String
pub fn connector_diff( &mut self, from: DiffTarget<'_>, to: DiffTarget<'_>, namespaces: Option<Namespaces> ) -> String
Generate a migration script using MigrationConnector::diff()
.
pub fn normalize_identifier<'a>(&self, identifier: &'a str) -> Cow<'a, str>
sourcepub fn query_raw(&mut self, q: &str, params: &[Value<'static>]) -> ResultSet
pub fn query_raw(&mut self, q: &str, params: &[Value<'static>]) -> ResultSet
Like quaint::Queryable::query_raw()
sourcepub fn raw_cmd(&mut self, sql: &str)
pub fn raw_cmd(&mut self, sql: &str)
Send a SQL command to the database, and expect it to succeed.
sourcepub fn render_table_name(&self, table_name: &str) -> Table<'static>
pub fn render_table_name(&self, table_name: &str) -> Table<'static>
Render a table name with the required prefixing for use with quaint query building.
pub fn expect_sql_for_schema(&mut self, schema: &'static str, sql: &Expect)
sourcepub fn schema_push_w_datasource(
&mut self,
dm: impl Into<String>
) -> SchemaPush<'_>
pub fn schema_push_w_datasource( &mut self, dm: impl Into<String> ) -> SchemaPush<'_>
Plan a schemaPush
command adding the datasource
sourcepub fn schema_push(&mut self, dm: impl Into<String>) -> SchemaPush<'_>
pub fn schema_push(&mut self, dm: impl Into<String>) -> SchemaPush<'_>
Plan a schemaPush
command
sourcepub fn write_datasource_block(
&self,
out: &mut dyn Write,
params: &[(&str, &str)],
preview_features: &'static [&'static str]
)
pub fn write_datasource_block( &self, out: &mut dyn Write, params: &[(&str, &str)], preview_features: &'static [&'static str] )
Render a valid datasource block, including database URL.
pub fn generator_block(&self) -> String
pub fn datamodel_with_provider(&self, schema: &str) -> String
pub fn datamodel_with_provider_and_features( &self, schema: &str, params: &[(&str, &str)], preview_features: &'static [&'static str] ) -> String
Auto Trait Implementations§
impl !RefUnwindSafe for TestApi
impl Send for TestApi
impl Sync for TestApi
impl Unpin for TestApi
impl !UnwindSafe for TestApi
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<Choices> CoproductSubsetter<CNil, HNil> for Choices
impl<Choices> CoproductSubsetter<CNil, HNil> for Choices
source§impl<T> FmtForward for T
impl<T> FmtForward for T
source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where Self: Binary,
self
to use its Binary
implementation when Debug
-formatted.source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where Self: Display,
self
to use its Display
implementation when
Debug
-formatted.source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where Self: LowerExp,
self
to use its LowerExp
implementation when
Debug
-formatted.source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where Self: LowerHex,
self
to use its LowerHex
implementation when
Debug
-formatted.source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where Self: Octal,
self
to use its Octal
implementation when Debug
-formatted.source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where Self: Pointer,
self
to use its Pointer
implementation when
Debug
-formatted.source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where Self: UpperExp,
self
to use its UpperExp
implementation when
Debug
-formatted.source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where Self: UpperHex,
self
to use its UpperHex
implementation when
Debug
-formatted.source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere T: ?Sized,
source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere Self: Sized,
source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere R: 'a,
self
and passes that borrow into the pipe function. Read moresource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere R: 'a,
self
and passes that borrow into the pipe function. Read moresource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> Rwhere
Self: Borrow<B>,
B: 'a + ?Sized,
R: 'a,
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> Rwhere Self: Borrow<B>, B: 'a + ?Sized, R: 'a,
source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R
) -> Rwhere
Self: BorrowMut<B>,
B: 'a + ?Sized,
R: 'a,
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R ) -> Rwhere Self: BorrowMut<B>, B: 'a + ?Sized, R: 'a,
source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> Rwhere
Self: AsRef<U>,
U: 'a + ?Sized,
R: 'a,
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> Rwhere Self: AsRef<U>, U: 'a + ?Sized, R: 'a,
self
, then passes self.as_ref()
into the pipe function.source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> Rwhere
Self: AsMut<U>,
U: 'a + ?Sized,
R: 'a,
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> Rwhere Self: AsMut<U>, U: 'a + ?Sized, R: 'a,
self
, then passes self.as_mut()
into the pipe
function.source§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<T> Tap for T
impl<T> Tap for T
source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Selfwhere Self: Borrow<B>, B: ?Sized,
Borrow<B>
of a value. Read moresource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere Self: BorrowMut<B>, B: ?Sized,
BorrowMut<B>
of a value. Read moresource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Selfwhere Self: AsRef<R>, R: ?Sized,
AsRef<R>
view of a value. Read moresource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere Self: AsMut<R>, R: ?Sized,
AsMut<R>
view of a value. Read moresource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Selfwhere
Self: Deref<Target = T>,
T: ?Sized,
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Selfwhere Self: Deref<Target = T>, T: ?Sized,
Deref::Target
of a value. Read moresource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Selfwhere
Self: DerefMut<Target = T> + Deref,
T: ?Sized,
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Selfwhere Self: DerefMut<Target = T> + Deref, T: ?Sized,
Deref::Target
of a value. Read moresource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap()
only in debug builds, and is erased in release builds.source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut()
only in debug builds, and is erased in release
builds.source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Selfwhere Self: Borrow<B>, B: ?Sized,
.tap_borrow()
only in debug builds, and is erased in release
builds.source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere Self: BorrowMut<B>, B: ?Sized,
.tap_borrow_mut()
only in debug builds, and is erased in release
builds.source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Selfwhere Self: AsRef<R>, R: ?Sized,
.tap_ref()
only in debug builds, and is erased in release
builds.source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere Self: AsMut<R>, R: ?Sized,
.tap_ref_mut()
only in debug builds, and is erased in release
builds.