use displaydoc::Display;
use serde::{Deserialize, Serialize};
use crate::rubase::rutils::str_utils;
use crate::rubase::{BaseEntity};
#[derive(Debug, Clone,Default, Deserialize, Serialize)]
pub struct Gorm {
pub debug: String,
pub dbType: String,
pub enable: String, pub maxIdletime: i32, pub maxLifetime: i32, pub maxOpenConns: i32, pub maxIdleConns: i32, }
impl BaseEntity for Gorm {
}
impl Gorm {
pub fn new() -> Gorm {
Self {
debug: "false".to_string(),
dbType: "mysql".to_string(),
enable: "true".to_string(),
maxIdletime: 900,
maxLifetime: 7200,
maxOpenConns: 150,
maxIdleConns: 50,
}
}
pub fn parse_env_var(&mut self) {
self.debug= str_utils::parse_env_var(std::mem::take(&mut self.debug));
self.dbType= str_utils::parse_env_var(std::mem::take(&mut self.dbType));
self.enable= str_utils::parse_env_var(std::mem::take(&mut self.enable));
}
}