ruwebframe 0.1.8

a simple webframe for rust actix-web, based on rudi and rbatis.
Documentation
use displaydoc::Display;
use serde::{Deserialize, Serialize};
use crate::rubase::BaseEntity;
use crate::rubase::rutils::str_utils;

#[derive(Debug, Clone, Display,Default, Deserialize, Serialize)]
pub struct DataSource {
    dbtype: String,
    dbname: String,
    host: String,
    port: String,     //${DB_PORT:5432}
    username: String, //${DB_USER:postgres}
    password: String, //${DB_PASSWORD:enc(ap3bkQhgwYOYarqeXA0wTJqTTAA/CPJu2FJAyIIDUKI=)}
    sslmode: String,  //${DB_SSLMODE:disable}
    charset: String,
}

impl BaseEntity for DataSource {

}
impl DataSource {
    pub fn new() -> DataSource {
        Self {

            ..Default::default()
        }
    }
    pub fn buildUrl(&self) -> String {
        format!(
            "host={} port={} user={} dbname={} password={}",
            self.host, self.port, self.username, self.dbname, self.password
        ) // 如果需要 TLS 可换成 openssl 等
    }
    pub fn parse_env_var(&mut self)   {
        self.dbtype= str_utils::parse_env_var(std::mem::take(&mut self.dbtype));
        self.dbname= str_utils::parse_env_var(std::mem::take(&mut self.dbname));
        self.host= str_utils::parse_env_var(std::mem::take(&mut self.host));
        self.port= str_utils::parse_env_var(std::mem::take(&mut self.port));
        self.username= str_utils::parse_env_var(std::mem::take(&mut self.username));
        self.password= str_utils::parse_env_var(std::mem::take(&mut self.password));
        self.sslmode= str_utils::parse_env_var(std::mem::take(&mut self.sslmode));
        self.charset= str_utils::parse_env_var(std::mem::take(&mut self.charset));

    }
}