pub struct Config {
pub migration: MigrationConfig,
}Expand description
Configuration for Toasty CLI operations.
Holds all settings that control how the CLI behaves. Currently this is
limited to MigrationConfig. A Config can be built programmatically
with the builder methods or loaded from a Toasty.toml file via
Config::load.
§Examples
use toasty_cli::{Config, MigrationConfig, MigrationPrefixStyle};
let config = Config::new()
.migration(
MigrationConfig::new()
.path("db")
.prefix_style(MigrationPrefixStyle::Timestamp),
);
assert_eq!(
config.migration.get_migrations_dir(),
std::path::PathBuf::from("db/migrations"),
);Fields§
§migration: MigrationConfigMigration-related configuration
Implementations§
Source§impl Config
impl Config
Sourcepub fn load_or_default(project_root: &Path) -> Result<Self>
pub fn load_or_default(project_root: &Path) -> Result<Self>
Load configuration from <project_root>/Toasty.toml, or the defaults
when the file does not exist. Never creates the file: read-only
commands must work against a read-only checkout.
Sourcepub fn create_if_missing(project_root: &Path) -> Result<()>
pub fn create_if_missing(project_root: &Path) -> Result<()>
Writes a default Toasty.toml into project_root if none is there.
Sourcepub fn migration(self, migration: MigrationConfig) -> Self
pub fn migration(self, migration: MigrationConfig) -> Self
Set the migration configuration
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Config
impl<'de> Deserialize<'de> for Config
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for Config
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnsafeUnpin for Config
impl UnwindSafe for Config
Blanket Implementations§
§impl<T> Assign<Json<T>> for Twhere
T: Serialize,
impl<T> Assign<Json<T>> for Twhere
T: Serialize,
§fn into_assignment(self) -> Assignment<Json<T>>
fn into_assignment(self) -> Assignment<Json<T>>
Convert into an [
Assignment<T>] value.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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
impl<T> ErasedDestructor for Twhere
T: 'static,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more