~lthms/ogmios

ref: a9dfab525b5d97bf6313db5d375b3810a173d12c ogmios/src/db.rs -rw-r--r-- 377 bytes View raw
a9dfab52Thomas Letan deps: Update semantic-ui 1 year, 6 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
use diesel::Connection;
use ::errors::Error;

#[database("pg_url")]
pub struct PgConn(diesel::PgConnection);

impl PgConn {
    pub fn get(&self) -> &diesel::PgConnection {
        &self.0
    }

    pub fn transaction<A, F>(
        &self,
        f: F
    ) -> Result<A, Error>
    where F: FnOnce() -> Result<A, Error> {
        self.0.transaction::<_, Error, _>(f)
    }
}