DatabaseConnection impl Sync, Send and Clone
This commit is contained in:
parent
27807f3f6c
commit
3093cd2035
@ -1,6 +1,7 @@
|
||||
use crate::{error::*, ExecResult, QueryResult, Statement, StatementBuilder};
|
||||
use sea_query::{MysqlQueryBuilder, PostgresQueryBuilder, QueryBuilder, SqliteQueryBuilder};
|
||||
|
||||
#[cfg_attr(not(feature = "mock"), derive(Clone))]
|
||||
pub enum DatabaseConnection {
|
||||
#[cfg(feature = "sqlx-mysql")]
|
||||
SqlxMySqlPoolConnection(crate::SqlxMySqlPoolConnection),
|
||||
@ -143,3 +144,15 @@ impl DbBackend {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::DatabaseConnection;
|
||||
|
||||
#[test]
|
||||
fn assert_database_connection_traits() {
|
||||
fn assert_send_sync<T: Send + Sync>() {}
|
||||
|
||||
assert_send_sync::<DatabaseConnection>();
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ use super::sqlx_common::*;
|
||||
#[derive(Debug)]
|
||||
pub struct SqlxMySqlConnector;
|
||||
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct SqlxMySqlPoolConnection {
|
||||
pool: MySqlPool,
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ use super::sqlx_common::*;
|
||||
#[derive(Debug)]
|
||||
pub struct SqlxPostgresConnector;
|
||||
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct SqlxPostgresPoolConnection {
|
||||
pool: PgPool,
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ use super::sqlx_common::*;
|
||||
#[derive(Debug)]
|
||||
pub struct SqlxSqliteConnector;
|
||||
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct SqlxSqlitePoolConnection {
|
||||
pool: SqlitePool,
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user