Skip to main content

run_with_seeders

Function run_with_seeders 

Source
pub fn run_with_seeders(
    args: &[String],
    seeders: &Seeders,
    out: &mut dyn Write,
    err: &mut dyn Write,
) -> i32
Available on (crate features model-mysql or model-postgres or model-sqlite) and non-WebAssembly only.
Expand description

As run, with seeders run after the SQL seed files by seed (18.30.0) — for an app’s own binary, so myapp db seed runs the seeds written in Rust too (the rws binary can’t link them):

ⓘ
let args: Vec<String> = std::env::args().collect();
if let Some(db_args) = rust_web_server::db_cli::requested(&args) {
    let code = rust_web_server::db_cli::run_with_seeders(db_args, &myapp::seeders(), &mut std::io::stdout(), &mut std::io::stderr());
    std::process::exit(code);
}

With seeders, a missing seeds directory means no SQL seeds rather than an error (DbPool::seed_with).