br_pgsql/pools.rs
1use crate::config::Config;
2use crate::connect::Connect;
3
4#[derive(Clone)]
5pub struct Pools {
6 /// 线程数量
7 pub config: Config,
8}
9
10impl Pools {
11 pub fn new(config: Config) -> Result<Self, String> {
12 Ok(Self {
13 config
14 })
15 }
16 pub fn get_connect(&mut self) -> Result<Connect, String> {
17 //let list = self.pools.clone();
18 //for (index, state, connect) in list {
19 // match state {
20 // true => {
21 // self.pools[index].1 = false;
22 // return Ok(connect.to_owned());
23 // }
24 // false => {}
25 // }
26 //}
27 //let con = Connect::new(self.config.clone())?;
28 //self.pools.push((0, false, con.clone()));
29 //Ok(con)
30 Connect::new(self.config.clone())
31 }
32}