1use crate::{Connection, Prepared, Result, Transaction, writer::SqlWriter};
2use std::{borrow::Cow, fmt::Debug, future::Future};
3
4pub trait Driver: Debug {
6 type Connection: Connection;
8 type SqlWriter: SqlWriter;
10 type Prepared: Prepared;
12 type Transaction<'c>: Transaction<'c>;
14
15 const NAME: &'static str;
17
18 fn name(&self) -> &'static str {
20 Self::NAME
21 }
22
23 fn connect(&self, url: Cow<'static, str>) -> impl Future<Output = Result<impl Connection>> {
25 Self::Connection::connect(url)
26 }
27
28 fn sql_writer(&self) -> Self::SqlWriter;
30}