next_web_dev/autoconfigure/context/
datasource_properties.rs1#[derive(Debug, Clone, serde::Deserialize)]
2pub struct DataSourceProperties {
3 id: String,
4 driver: String,
5 host: String,
6 port: u16,
7 username: String,
8 password: String,
9 database: String,
10 url_extra: Option<String>,
11}
12
13impl DataSourceProperties {
14 pub fn id(&self) -> &str {
15 &self.id
16 }
17
18 pub fn driver(&self) -> &str {
19 &self.driver
20 }
21
22 pub fn host(&self) -> &str {
23 &self.host
24 }
25
26 pub fn port(&self) -> u16 {
27 self.port
28 }
29
30 pub fn username(&self) -> &str {
31 &self.username
32 }
33
34 pub fn password(&self) -> &str {
35 &self.password
36 }
37
38 pub fn database(&self) -> &str {
39 &self.database
40 }
41
42 pub fn url_extra(&self) -> Option<&str> {
43 self.url_extra.as_ref().map(|s| s.as_str())
44 }
45}