cdbc_mssql/options/
mod.rs

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