cartel-pg 0.29.0

Async PostgreSQL driver for the dope runtime
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use crate::api::task::lease::{Lease, Recover};
use crate::{port::pool::access, schema};

pub(in crate::api) type Held<'app, 'g, 'r, 's, 'b, 'c, 'd, B, I, const ID: u8 = 0> =
    Lease<'app, 'g, 'r, 's, 'b, 'c, 'd, B, I, access::Transaction<'d, ID>, Recover, ID>;

impl<'app, 'g, 'r, 's, 'b, 'c, 'd: 'app, B: ?Sized, I: schema::QuerySet + 'd, const ID: u8>
    Held<'app, 'g, 'r, 's, 'b, 'c, 'd, B, I, ID>
{
    pub(in crate::api) fn begin(
        self,
    ) -> Lease<'app, 'g, 'r, 's, 'b, 'c, 'd, B, I, access::Finalization<'d, ID>, Recover, ID> {
        let client = self.client();
        let state = client.port.shared.transaction().begin_finish(self.settle());
        Lease::new(client, state)
    }
}