poem_dbsession/config.rs
1#![allow(dead_code)]
2
3/// A configuration for database.
4pub struct DatabaseConfig {
5 pub(crate) table_name: String,
6}
7
8impl Default for DatabaseConfig {
9 fn default() -> Self {
10 DatabaseConfig {
11 table_name: "poem_sessions".to_string(),
12 }
13 }
14}
15
16impl DatabaseConfig {
17 /// Create an [`DatabaseConfig`].
18 pub fn new() -> Self {
19 Default::default()
20 }
21
22 /// Specifies the table name.
23 pub fn table_name(self, table_name: impl Into<String>) -> Self {
24 Self {
25 table_name: table_name.into(),
26 }
27 }
28}