feat: add PostgreSQL connection form
This commit is contained in:
@@ -48,7 +48,10 @@ pub struct Page {
|
||||
|
||||
impl Database {
|
||||
pub fn connect(connection: &str) -> Result<Self> {
|
||||
let mut config: Config = connection.parse()?;
|
||||
Self::connect_postgres(connection.parse()?)
|
||||
}
|
||||
|
||||
pub fn connect_postgres(mut config: Config) -> Result<Self> {
|
||||
if config.get_connect_timeout().is_none() {
|
||||
config.connect_timeout(Duration::from_secs(5));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user