mirror of
https://github.com/launchbadge/sqlx.git
synced 2025-10-01 15:03:27 +00:00
Make the database kind queryable from AnyConnectionKind and AnyConnection (#1592)
This commit is contained in:
parent
d258e8c681
commit
beb2100f29
@ -1,6 +1,6 @@
|
||||
use futures_core::future::BoxFuture;
|
||||
|
||||
use crate::any::{Any, AnyConnectOptions};
|
||||
use crate::any::{Any, AnyConnectOptions, AnyKind};
|
||||
use crate::connection::Connection;
|
||||
use crate::error::Error;
|
||||
|
||||
@ -47,6 +47,30 @@ pub(crate) enum AnyConnectionKind {
|
||||
Sqlite(sqlite::SqliteConnection),
|
||||
}
|
||||
|
||||
impl AnyConnectionKind {
|
||||
pub fn kind(&self) -> AnyKind {
|
||||
match self {
|
||||
#[cfg(feature = "postgres")]
|
||||
AnyConnectionKind::Postgres(_) => AnyKind::Postgres,
|
||||
|
||||
#[cfg(feature = "mysql")]
|
||||
AnyConnectionKind::MySql(_) => AnyKind::MySql,
|
||||
|
||||
#[cfg(feature = "sqlite")]
|
||||
AnyConnectionKind::Sqlite(_) => AnyKind::Sqlite,
|
||||
|
||||
#[cfg(feature = "mssql")]
|
||||
AnyConnectionKind::Mssql(_) => AnyKind::Mssql,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl AnyConnection {
|
||||
pub fn kind(&self) -> AnyKind {
|
||||
self.0.kind()
|
||||
}
|
||||
}
|
||||
|
||||
macro_rules! delegate_to {
|
||||
($self:ident.$method:ident($($arg:ident),*)) => {
|
||||
match &$self.0 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user