mongodb_migrator/migrator/
with_shell_config.rs

1//! With this type of the migrator it's possible write JavaScript based migrations
2//! and run them via mongo shell(--eval flag)
3use super::{
4    shell::ShellConfig, with_connection::WithConnection, with_migrations_vec::WithMigrationsVec,
5};
6use crate::migration::Migration;
7
8#[derive(Clone)]
9pub struct WithShellConfig {
10    pub with_shell_config: ShellConfig,
11    pub with_connection: WithConnection,
12}
13
14impl WithShellConfig {
15    pub fn with_migrations_vec(self, migrations: Vec<Box<dyn Migration>>) -> WithMigrationsVec {
16        WithMigrationsVec {
17            migrations,
18            // TODO(kakoc): rework forwarding: merge? split? -clone?
19            with_shell_config: Some(self.clone()),
20            with_connection: self.with_connection,
21        }
22    }
23}