tank_core/
driver.rs

1use crate::{Connection, Prepared, Result, Transaction, writer::SqlWriter};
2use std::{borrow::Cow, future::Future};
3
4pub trait Driver {
5    type Connection: Connection;
6    type SqlWriter: SqlWriter;
7    type Prepared: Prepared;
8
9    const NAME: &'static str;
10
11    fn connect(&self, url: Cow<'static, str>) -> impl Future<Output = Result<impl Connection>> {
12        Self::Connection::connect(url)
13    }
14
15    fn sql_writer(&self) -> Self::SqlWriter;
16}
17
18pub trait DriverTransactional: Driver {
19    type Transaction<'c>: Transaction<'c>;
20}