Skip to main content

tank_mysql/
driver.rs

1use crate::{MySQLConnection, MySQLPrepared, MySQLSqlWriter, MySQLTransaction};
2use tank_core::Driver;
3
4/// MySQL/MariaDB driver.
5#[derive(Clone, Copy, Default, Debug)]
6pub struct MySQLDriver;
7impl MySQLDriver {
8    pub const fn new() -> Self {
9        Self
10    }
11}
12
13/// Alias for MariaDB.
14pub type MariaDBDriver = MySQLDriver;
15
16impl Driver for MySQLDriver {
17    type Connection = MySQLConnection;
18    type SqlWriter = MySQLSqlWriter;
19    type Prepared = MySQLPrepared;
20    type Transaction<'c> = MySQLTransaction<'c>;
21
22    const NAME: &'static [&'static str] = &["mysql", "mariadb"];
23    fn sql_writer(&self) -> Self::SqlWriter {
24        MySQLSqlWriter::default()
25    }
26}