ruwebframe 0.1.4

a simple webframe for rust actix-web, based on rudi and rbatis.
Documentation
use crate::rubase::{rudto, BaseEntitySingle   };
use crate::rucfg ;
use postgres::Client;
use serde::{Deserialize, Serialize};
use tokio_postgres::NoTls;
use crate::rubase::getself::GetSelf;

#[derive(Debug,Default,Serialize,Deserialize,Clone)]
pub struct Database {
   pub gorm: rudto::Gorm,
   pub datasource: rudto::DataSource,
}

impl BaseEntitySingle for Database {}
impl GetSelf for Database {}
impl Database {
    pub fn new() -> Self {
        let config = rucfg::find_bean_ruconfig().unwrap().read();
        Database {
            gorm: config.gorm,
            datasource: config.datasource,
        }
    }
    pub fn conn(&self) -> Result<Client, postgres::Error> {
        let   client = Client::connect(
            self.datasource.buildUrl().to_string().as_str(),
            NoTls, // 如果需要 TLS 可换成 openssl 等
        )?;
        Ok(client)
    }
}