toasty_driver_mysql/
mariadb.rs1use super::MySQL;
2use async_trait::async_trait;
3use std::borrow::Cow;
4use toasty_core::{
5 Result,
6 driver::{Capability, ConnectContext, Connection, Driver},
7};
8
9#[derive(Debug)]
21pub struct MariaDB {
22 inner: MySQL,
23}
24
25impl MariaDB {
26 pub fn new(url: impl Into<String>) -> Result<Self> {
36 Ok(Self {
37 inner: MySQL::with_capability(url, "mariadb", &Capability::MARIADB)?,
38 })
39 }
40}
41
42#[async_trait]
43impl Driver for MariaDB {
44 fn url(&self) -> Cow<'_, str> {
45 self.inner.url()
46 }
47
48 fn capability(&self) -> &'static Capability {
49 &Capability::MARIADB
50 }
51
52 async fn connect(&self, cx: &ConnectContext) -> Result<Box<dyn Connection>> {
53 self.inner.connect(cx).await
54 }
55
56 async fn reset_db(&self) -> Result<()> {
57 self.inner.reset_db().await
58 }
59}