sqlx_core_guts/mssql/options/
mod.rs

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