Struct migrant_lib::config::SettingsFileInitializer[][src]

pub struct SettingsFileInitializer { /* fields omitted */ }

Project settings file builder to initialize a new settings file

Implementations

impl SettingsFileInitializer[src]

pub fn interactive(&mut self, b: bool) -> &mut Self[src]

Set interactive prompts, default is true

pub fn with_env_defaults(&mut self, b: bool) -> &mut Self[src]

Default all file values env:<ENV_VAR> if unspecified

pub fn with_sqlite_options(
    &mut self,
    options: &SqliteSettingsBuilder
) -> &mut Self
[src]

Specify Sqlite database options

Example:

use migrant_lib::Config;
use migrant_lib::config::SqliteSettingsBuilder;
Config::init_in(env::current_dir()?)
    .with_sqlite_options(
        SqliteSettingsBuilder::empty()
            .database_path("/abs/path/to/my.db")?)
    .initialize()?;

pub fn with_postgres_options(
    &mut self,
    options: &PostgresSettingsBuilder
) -> &mut Self
[src]

Specify Postgres database options

Example:

use migrant_lib::Config;
use migrant_lib::config::PostgresSettingsBuilder;
Config::init_in(env::current_dir()?)
    .with_postgres_options(
        PostgresSettingsBuilder::empty()
            .database_name("my_db")
            .database_user("me")
            .database_port(4444))
    .initialize()?;

pub fn with_mysql_options(
    &mut self,
    options: &MySqlSettingsBuilder
) -> &mut Self
[src]

Specify MySQL database options

Example:

use migrant_lib::Config;
use migrant_lib::config::MySqlSettingsBuilder;
Config::init_in(env::current_dir()?)
    .with_mysql_options(
        MySqlSettingsBuilder::empty()
            .database_name("my_db")
            .database_user("me")
            .database_port(4444))
    .initialize()?;

pub fn initialize(&self) -> Result<()>[src]

Generate a template config file using provided parameters or prompting the user. If running interactively, the file will be opened for editing and Config::setup will be run automatically.

Trait Implementations

impl Clone for SettingsFileInitializer[src]

impl Debug for SettingsFileInitializer[src]

Auto Trait Implementations

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> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.