From ecbd7c2713796722afdc13a7cd9a3c051289320d Mon Sep 17 00:00:00 2001 From: Ivan Krivosheev Date: Sat, 3 Sep 2022 18:42:51 +0300 Subject: [PATCH] issues-969 Update dependencies issues-969 Fix sqlx_query function --- Cargo.toml | 8 ++++---- src/driver/sqlx_mysql.rs | 10 +++++----- src/driver/sqlx_postgres.rs | 10 +++++----- src/driver/sqlx_sqlite.rs | 10 +++++----- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index db0976fcf..8751e6604 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,16 +26,16 @@ path = "src/lib.rs" [dependencies] async-stream = { version = "^0.3" } async-trait = { version = "^0.1" } -chrono = { version = "^0.4", optional = true } +chrono = { version = "^0.4.20", default-features = false, features = ["clock"], optional = true } time = { version = "^0.3", optional = true } futures = { version = "^0.3" } futures-util = { version = "^0.3" } log = { version = "^0.4" } tracing = { version = "^0.1", features = ["log"] } rust_decimal = { version = "^1", optional = true } -sea-orm-macros = { version = "^0.9.1", path = "sea-orm-macros", optional = true } -sea-query = { git = "https://github.com/ikrivosheev/sea-query", version = "^0.27", features = ["thread-safe"] } -sea-query-binder = { git = "https://github.com/ikrivosheev/sea-query", version = "^0.1", optional = true } +sea-orm-macros = { version = "^0.10.0", path = "sea-orm-macros", optional = true } +sea-query = { git = "https://github.com/SeaQL/sea-query", branch = "master", version = "^0.27", features = ["thread-safe"] } +sea-query-binder = { git = "https://github.com/SeaQL/sea-query", branch = "master", version = "^0.1", optional = true } sea-strum = { version = "^0.23", features = ["derive", "sea-orm"] } serde = { version = "^1.0", features = ["derive"] } serde_json = { version = "^1.0", optional = true } diff --git a/src/driver/sqlx_mysql.rs b/src/driver/sqlx_mysql.rs index c1526c697..c970a2c3b 100644 --- a/src/driver/sqlx_mysql.rs +++ b/src/driver/sqlx_mysql.rs @@ -216,9 +216,9 @@ impl From for ExecResult { } pub(crate) fn sqlx_query(stmt: &Statement) -> sqlx::query::Query<'_, MySql, SqlxValues> { - if let Some(values) = &stmt.values { - sqlx::query_with(&stmt.sql, SqlxValues(values.clone())) - } else { - sqlx::query_with(&stmt.sql, SqlxValues(Values(Vec::new()))) - } + let values = stmt + .values + .as_ref() + .map_or(Values(Vec::new()), |values| values.clone()); + sqlx::query_with(&stmt.sql, SqlxValues(values)) } diff --git a/src/driver/sqlx_postgres.rs b/src/driver/sqlx_postgres.rs index 11150fb98..7737c08fe 100644 --- a/src/driver/sqlx_postgres.rs +++ b/src/driver/sqlx_postgres.rs @@ -216,9 +216,9 @@ impl From for ExecResult { } pub(crate) fn sqlx_query(stmt: &Statement) -> sqlx::query::Query<'_, Postgres, SqlxValues> { - if let Some(values) = &stmt.values { - sqlx::query_with(&stmt.sql, SqlxValues(values.clone())) - } else { - sqlx::query_with(&stmt.sql, SqlxValues(Values(Vec::new()))) - } + let values = stmt + .values + .as_ref() + .map_or(Values(Vec::new()), |values| values.clone()); + sqlx::query_with(&stmt.sql, SqlxValues(values)) } diff --git a/src/driver/sqlx_sqlite.rs b/src/driver/sqlx_sqlite.rs index 985430168..3898661af 100644 --- a/src/driver/sqlx_sqlite.rs +++ b/src/driver/sqlx_sqlite.rs @@ -223,9 +223,9 @@ impl From for ExecResult { } pub(crate) fn sqlx_query(stmt: &Statement) -> sqlx::query::Query<'_, Sqlite, SqlxValues> { - if let Some(values) = &stmt.values { - sqlx::query_with(&stmt.sql, SqlxValues(values.clone())) - } else { - sqlx::query_with(&stmt.sql, SqlxValues(Values(Vec::new()))) - } + let values = stmt + .values + .as_ref() + .map_or(Values(Vec::new()), |values| values.clone()); + sqlx::query_with(&stmt.sql, SqlxValues(values)) }