fix build error
This commit is contained in:
parent
1cf5cec1c5
commit
203a0d603a
@ -18,15 +18,15 @@ pub struct Database;
|
|||||||
impl Database {
|
impl Database {
|
||||||
pub async fn connect(string: &str) -> Result<DatabaseConnection, DbErr> {
|
pub async fn connect(string: &str) -> Result<DatabaseConnection, DbErr> {
|
||||||
#[cfg(feature = "sqlx-mysql")]
|
#[cfg(feature = "sqlx-mysql")]
|
||||||
if DbBackend::MySql::starts_with(string) {
|
if DbBackend::MySql.url_starts_with(string) {
|
||||||
return crate::SqlxMySqlConnector::connect(string).await;
|
return crate::SqlxMySqlConnector::connect(string).await;
|
||||||
}
|
}
|
||||||
#[cfg(feature = "sqlx-postgres")]
|
#[cfg(feature = "sqlx-postgres")]
|
||||||
if DbBackend::Postgres::starts_with(string) {
|
if DbBackend::Postgres.url_starts_with(string) {
|
||||||
return crate::SqlxPostgresConnector::connect(string).await;
|
return crate::SqlxPostgresConnector::connect(string).await;
|
||||||
}
|
}
|
||||||
#[cfg(feature = "sqlx-sqlite")]
|
#[cfg(feature = "sqlx-sqlite")]
|
||||||
if DbBackend::Sqlite::starts_with(string) {
|
if DbBackend::Sqlite.url_starts_with(string) {
|
||||||
return crate::SqlxSqliteConnector::connect(string).await;
|
return crate::SqlxSqliteConnector::connect(string).await;
|
||||||
}
|
}
|
||||||
#[cfg(feature = "mock")]
|
#[cfg(feature = "mock")]
|
||||||
|
@ -31,15 +31,15 @@ impl MockDatabaseConnector {
|
|||||||
#[allow(unused_variables)]
|
#[allow(unused_variables)]
|
||||||
pub fn accepts(string: &str) -> bool {
|
pub fn accepts(string: &str) -> bool {
|
||||||
#[cfg(feature = "sqlx-mysql")]
|
#[cfg(feature = "sqlx-mysql")]
|
||||||
if DbBackend::MySql::accepts(string) {
|
if DbBackend::MySql.url_starts_with(string) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#[cfg(feature = "sqlx-postgres")]
|
#[cfg(feature = "sqlx-postgres")]
|
||||||
if DbBackend::Postgres::accepts(string) {
|
if DbBackend::Postgres.url_starts_with(string) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#[cfg(feature = "sqlx-sqlite")]
|
#[cfg(feature = "sqlx-sqlite")]
|
||||||
if DbBackend::Sqlite::accepts(string) {
|
if DbBackend::Sqlite.url_starts_with(string) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
false
|
false
|
||||||
|
@ -20,7 +20,7 @@ pub struct SqlxMySqlPoolConnection {
|
|||||||
|
|
||||||
impl SqlxMySqlConnector {
|
impl SqlxMySqlConnector {
|
||||||
pub fn accepts(string: &str) -> bool {
|
pub fn accepts(string: &str) -> bool {
|
||||||
DbBackend::MySql::starts_with(string)
|
DbBackend::MySql.url_starts_with(string)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn connect(string: &str) -> Result<DatabaseConnection, DbErr> {
|
pub async fn connect(string: &str) -> Result<DatabaseConnection, DbErr> {
|
||||||
|
@ -20,7 +20,7 @@ pub struct SqlxPostgresPoolConnection {
|
|||||||
|
|
||||||
impl SqlxPostgresConnector {
|
impl SqlxPostgresConnector {
|
||||||
pub fn accepts(string: &str) -> bool {
|
pub fn accepts(string: &str) -> bool {
|
||||||
DbBackend::Postgres::starts_with(string)
|
DbBackend::Postgres.url_starts_with(string)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn connect(string: &str) -> Result<DatabaseConnection, DbErr> {
|
pub async fn connect(string: &str) -> Result<DatabaseConnection, DbErr> {
|
||||||
|
@ -20,7 +20,7 @@ pub struct SqlxSqlitePoolConnection {
|
|||||||
|
|
||||||
impl SqlxSqliteConnector {
|
impl SqlxSqliteConnector {
|
||||||
pub fn accepts(string: &str) -> bool {
|
pub fn accepts(string: &str) -> bool {
|
||||||
DbBackend::Sqlite::starts_with(string)
|
DbBackend::Sqlite.url_starts_with(string)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn connect(string: &str) -> Result<DatabaseConnection, DbErr> {
|
pub async fn connect(string: &str) -> Result<DatabaseConnection, DbErr> {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user