mongodb_migrator/migrator/
with_connection.rs

1use super::{
2    shell::ShellConfig, with_migrations_vec::WithMigrationsVec, with_shell_config::WithShellConfig,
3};
4use crate::migration::Migration;
5
6#[derive(Clone)]
7pub struct WithConnection {
8    pub db: mongodb::Database,
9}
10
11impl WithConnection {
12    pub fn with_migrations_vec(self, migrations: Vec<Box<dyn Migration>>) -> WithMigrationsVec {
13        WithMigrationsVec {
14            migrations,
15            with_connection: self,
16            with_shell_config: None,
17        }
18    }
19
20    pub fn with_shell_config(self, with_shell_config: ShellConfig) -> WithShellConfig {
21        WithShellConfig {
22            with_shell_config,
23            with_connection: self,
24        }
25    }
26}