use crate::{Connection, Prepared, Result, Transaction, writer::SqlWriter};
use std::{borrow::Cow, fmt::Debug, future::Future};
pub trait Driver: Default + Debug {
type Connection: Connection<Driver = Self>;
type SqlWriter: SqlWriter;
type Prepared: Prepared;
type Transaction<'c>: Transaction<'c>;
const NAME: &'static [&'static str];
fn name(&self) -> &'static str {
Self::NAME[0]
}
fn connect(&self, url: Cow<'static, str>) -> impl Future<Output = Result<Self::Connection>> {
Self::Connection::connect(self, url)
}
fn sql_writer(&self) -> Self::SqlWriter;
}