ruwebframe 0.1.2

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

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

impl ruentity::BaseEntitySingle 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 mut client = Client::connect(
            self.datasource.buildUrl().to_string().as_str(),
            NoTls, // 如果需要 TLS 可换成 openssl 等
        )?;
        Ok(client)
    }
}