mirror of
https://github.com/launchbadge/sqlx.git
synced 2026-02-27 18:29:39 +00:00
Implement From for AnyConnection (#1652)
* Implemented From for AnyConnection to cover the 4 Database type connections to AnyConnection * formatting
This commit is contained in:
parent
e7a50d3501
commit
183e620381
@ -183,3 +183,31 @@ impl Connection for AnyConnection {
|
||||
delegate_to!(self.should_flush())
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "postgres")]
|
||||
impl From<postgres::PgConnection> for AnyConnection {
|
||||
fn from(conn: postgres::PgConnection) -> Self {
|
||||
AnyConnection(AnyConnectionKind::Postgres(conn))
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "mssql")]
|
||||
impl From<mssql::MssqlConnection> for AnyConnection {
|
||||
fn from(conn: mssql::MssqlConnection) -> Self {
|
||||
AnyConnection(AnyConnectionKind::Mssql(conn))
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "mysql")]
|
||||
impl From<mysql::MySqlConnection> for AnyConnection {
|
||||
fn from(conn: mysql::MySqlConnection) -> Self {
|
||||
AnyConnection(AnyConnectionKind::MySql(conn))
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "sqlite")]
|
||||
impl From<sqlite::SqliteConnection> for AnyConnection {
|
||||
fn from(conn: sqlite::SqliteConnection) -> Self {
|
||||
AnyConnection(AnyConnectionKind::Sqlite(conn))
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user