fix build error

This commit is contained in:
baoyachi 2021-09-27 12:19:36 +08:00
parent 1cf5cec1c5
commit 203a0d603a
5 changed files with 9 additions and 9 deletions

View File

@ -18,15 +18,15 @@ pub struct Database;
impl Database {
pub async fn connect(string: &str) -> Result<DatabaseConnection, DbErr> {
#[cfg(feature = "sqlx-mysql")]
if DbBackend::MySql::starts_with(string) {
if DbBackend::MySql.url_starts_with(string) {
return crate::SqlxMySqlConnector::connect(string).await;
}
#[cfg(feature = "sqlx-postgres")]
if DbBackend::Postgres::starts_with(string) {
if DbBackend::Postgres.url_starts_with(string) {
return crate::SqlxPostgresConnector::connect(string).await;
}
#[cfg(feature = "sqlx-sqlite")]
if DbBackend::Sqlite::starts_with(string) {
if DbBackend::Sqlite.url_starts_with(string) {
return crate::SqlxSqliteConnector::connect(string).await;
}
#[cfg(feature = "mock")]

View File

@ -31,15 +31,15 @@ impl MockDatabaseConnector {
#[allow(unused_variables)]
pub fn accepts(string: &str) -> bool {
#[cfg(feature = "sqlx-mysql")]
if DbBackend::MySql::accepts(string) {
if DbBackend::MySql.url_starts_with(string) {
return true;
}
#[cfg(feature = "sqlx-postgres")]
if DbBackend::Postgres::accepts(string) {
if DbBackend::Postgres.url_starts_with(string) {
return true;
}
#[cfg(feature = "sqlx-sqlite")]
if DbBackend::Sqlite::accepts(string) {
if DbBackend::Sqlite.url_starts_with(string) {
return true;
}
false

View File

@ -20,7 +20,7 @@ pub struct SqlxMySqlPoolConnection {
impl SqlxMySqlConnector {
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> {

View File

@ -20,7 +20,7 @@ pub struct SqlxPostgresPoolConnection {
impl SqlxPostgresConnector {
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> {

View File

@ -20,7 +20,7 @@ pub struct SqlxSqlitePoolConnection {
impl SqlxSqliteConnector {
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> {