1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
use crate::connection::LogSettings; mod connect; mod parse; #[derive(Debug, Clone)] pub struct MssqlConnectOptions { pub(crate) host: String, pub(crate) port: u16, pub(crate) username: String, pub(crate) database: String, pub(crate) password: Option<String>, pub(crate) log_settings: LogSettings, } impl Default for MssqlConnectOptions { fn default() -> Self { Self::new() } } impl MssqlConnectOptions { pub fn new() -> Self { Self { port: 1433, host: String::from("localhost"), database: String::from("master"), username: String::from("sa"), password: None, log_settings: Default::default(), } } pub fn host(mut self, host: &str) -> Self { self.host = host.to_owned(); self } pub fn port(mut self, port: u16) -> Self { self.port = port; self } pub fn username(mut self, username: &str) -> Self { self.username = username.to_owned(); self } pub fn password(mut self, password: &str) -> Self { self.password = Some(password.to_owned()); self } pub fn database(mut self, database: &str) -> Self { self.database = database.to_owned(); self } }