ruwebframe 0.1.1

A brief description of your crate.
Documentation
use crate::rubase::{rudto, ruentity};
use crate::rucfg ;
use postgres::Client;
use serde::Serialize;
use tokio_postgres::NoTls;

#[derive(Debug,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() -> Result<Client, postgres::Error> {
        let mut client = Client::connect(
            rudto::DataSource::new().buildUrl().to_string().as_str(),
            NoTls, // 如果需要 TLS 可换成 openssl 等
        )?;
        Ok(client)
    }
}

// StructInfo 
// {{StructInfo}}