[][src]Struct testfixtures::Loader

pub struct Loader<D, C, O, Tz> where
    D: Database + Sync + Send,
    C: Connection<Database = D> + Connect<Database = D> + Sync + Send,
    O: Offset,
    Tz: TimeZone<Offset = O> + Send + Sync
{ pub pool: Option<Pool<C>>, pub helper: Option<Box<dyn DB<D, C, O, Tz>>>, pub fixture_files: Vec<FixtureFile<Tz>>, pub skip_test_database_check: bool, pub location: Option<Tz>, }

This type accepts and set some options.

Fields

pool: Option<Pool<C>>helper: Option<Box<dyn DB<D, C, O, Tz>>>fixture_files: Vec<FixtureFile<Tz>>skip_test_database_check: boollocation: Option<Tz>

Implementations

impl<D, C, O, Tz> Loader<D, C, O, Tz> where
    D: Database + Sync + Send,
    C: Connection<Database = D> + Connect<Database = D> + Sync + Send,
    O: Offset + Display + Send + Sync,
    Tz: TimeZone<Offset = O> + Send + Sync
[src]

pub async fn load<'_>(&'_ self) -> Result<()>[src]

Execute SQL queries builded from yaml files.

pub fn database(&mut self, pool: Pool<C>)[src]

Set database pool.

pub fn skip_test_database_check(&mut self)[src]

Turn test database check off.

pub fn location(&mut self, location: Tz)[src]

Set timezone.

pub fn files(&mut self, files: Vec<&str>)[src]

Set fixture files directly.

pub fn directory(&mut self, directory: &str)[src]

Set fixture files from a directory.

pub fn paths(&mut self, paths: Vec<&str>)[src]

This option is a combination of files option and directory option.

impl<O, Tz> Loader<MySql, MySqlConnection, O, Tz> where
    O: Offset + Display + Send + Sync + 'static,
    Tz: TimeZone<Offset = O> + Send + Sync + 'static, 
[src]

pub async fn new<F>(options: F) -> Result<MySqlLoader<O, Tz>> where
    F: FnOnce(&mut MySqlLoader<O, Tz>), 
[src]

Creates a Loader, specialized for MySQL and Set options.

Example

#[cfg(test)]
mod tests {
    use testfixtures::MySqlLoader;
    #[async_std::test]
    async fn test_something() -> anyhow::Result<()> {
        let loader = MySqlLoader::new(|cfg| {
            //...
        })
        .await?;
        Ok(())
    }
}

Trait Implementations

impl<D, C, O, Tz> Default for Loader<D, C, O, Tz> where
    D: Database + Sync + Send,
    C: Connection<Database = D> + Connect<Database = D> + Sync + Send,
    O: Offset,
    Tz: TimeZone<Offset = O> + Send + Sync
[src]

Auto Trait Implementations

impl<D, C, O, Tz> !RefUnwindSafe for Loader<D, C, O, Tz>

impl<D, C, O, Tz> !Send for Loader<D, C, O, Tz>

impl<D, C, O, Tz> !Sync for Loader<D, C, O, Tz>

impl<D, C, O, Tz> Unpin for Loader<D, C, O, Tz> where
    O: Unpin,
    Tz: Unpin

impl<D, C, O, Tz> !UnwindSafe for Loader<D, C, O, Tz>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,