issues-969 Replace sea-query-driver to sea-query-binder
This commit is contained in:
parent
d532deb636
commit
581684c441
46
Cargo.toml
46
Cargo.toml
@ -33,8 +33,9 @@ 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.10.0", path = "sea-orm-macros", optional = true }
|
||||
sea-query = { version = "^0.26.3", features = ["thread-safe"] }
|
||||
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" }
|
||||
sea-strum = { version = "^0.23", features = ["derive", "sea-orm"] }
|
||||
serde = { version = "^1.0", features = ["derive"] }
|
||||
serde_json = { version = "^1.0", optional = true }
|
||||
@ -69,19 +70,20 @@ default = [
|
||||
]
|
||||
macros = ["sea-orm-macros"]
|
||||
mock = []
|
||||
with-json = ["serde_json", "sea-query/with-json", "chrono/serde", "sqlx?/json"]
|
||||
with-chrono = ["chrono", "sea-query/with-chrono", "sqlx?/chrono"]
|
||||
with-rust_decimal = ["rust_decimal", "sea-query/with-rust_decimal", "sqlx?/decimal"]
|
||||
with-uuid = ["uuid", "sea-query/with-uuid", "sqlx?/uuid"]
|
||||
with-time = ["time", "sea-query/with-time", "sqlx?/time"]
|
||||
with-json = ["serde_json", "sea-query/with-json", "chrono/serde", "sea-query-binder/with-json", "sqlx?/json"]
|
||||
with-chrono = ["chrono", "sea-query/with-chrono", "sea-query-binder/with-chrono", "sqlx?/chrono"]
|
||||
with-rust_decimal = ["rust_decimal", "sea-query/with-rust_decimal", "sea-query-binder/with-rust_decimal", "sqlx?/decimal"]
|
||||
with-uuid = ["uuid", "sea-query/with-uuid", "sea-query-binder/with-uuid", "sqlx?/uuid"]
|
||||
with-time = ["time", "sea-query/with-time", "sea-query-binder/with-time", "sqlx?/time"]
|
||||
sqlx-dep = []
|
||||
sqlx-all = ["sqlx-mysql", "sqlx-postgres", "sqlx-sqlite"]
|
||||
sqlx-mysql = ["sqlx-dep", "sea-query/sqlx-mysql", "sqlx/mysql"]
|
||||
sqlx-postgres = ["sqlx-dep", "sea-query/sqlx-postgres", "sqlx/postgres"]
|
||||
sqlx-sqlite = ["sqlx-dep", "sea-query/sqlx-sqlite", "sqlx/sqlite"]
|
||||
sqlx-mysql = ["sqlx-dep", "sea-query-binder/sqlx-mysql", "sqlx/mysql"]
|
||||
sqlx-postgres = ["sqlx-dep", "sea-query-binder/sqlx-postgres", "sqlx/postgres"]
|
||||
sqlx-sqlite = ["sqlx-dep", "sea-query-binder/sqlx-postgres", "sqlx/sqlite"]
|
||||
runtime-async-std = []
|
||||
runtime-async-std-native-tls = [
|
||||
"sqlx/runtime-async-std-native-tls",
|
||||
"sea-query-binder/runtime-async-std-native-tls",
|
||||
"runtime-async-std",
|
||||
]
|
||||
runtime-async-std-rustls = [
|
||||
@ -89,8 +91,24 @@ runtime-async-std-rustls = [
|
||||
"runtime-async-std",
|
||||
]
|
||||
runtime-actix = []
|
||||
runtime-actix-native-tls = ["sqlx/runtime-actix-native-tls", "runtime-actix"]
|
||||
runtime-actix-rustls = ["sqlx/runtime-actix-rustls", "runtime-actix"]
|
||||
runtime-actix-native-tls = [
|
||||
"sqlx/runtime-actix-native-tls",
|
||||
"sea-query-binder/runtime-actix-native-tls",
|
||||
"runtime-actix",
|
||||
]
|
||||
runtime-actix-rustls = [
|
||||
"sqlx/runtime-actix-rustls",
|
||||
"sea-query-binder/runtime-actix-rustls",
|
||||
"runtime-actix",
|
||||
]
|
||||
runtime-tokio = []
|
||||
runtime-tokio-native-tls = ["sqlx/runtime-tokio-native-tls", "runtime-tokio"]
|
||||
runtime-tokio-rustls = ["sqlx/runtime-tokio-rustls", "runtime-tokio"]
|
||||
runtime-tokio-native-tls = [
|
||||
"sqlx/runtime-tokio-native-tls",
|
||||
"sea-query-binder/runtime-tokio-native-tls",
|
||||
"runtime-tokio",
|
||||
]
|
||||
runtime-tokio-rustls = [
|
||||
"sqlx/runtime-tokio-rustls",
|
||||
"sea-query-binder/runtime-tokio-rustls",
|
||||
"runtime-tokio",
|
||||
]
|
||||
|
@ -1,3 +1,4 @@
|
||||
use sea_query::Values;
|
||||
use std::{future::Future, pin::Pin, sync::Arc};
|
||||
|
||||
use sqlx::{
|
||||
@ -5,8 +6,7 @@ use sqlx::{
|
||||
MySql, MySqlPool,
|
||||
};
|
||||
|
||||
sea_query::sea_query_driver_mysql!();
|
||||
use sea_query_driver_mysql::bind_query;
|
||||
use sea_query_binder::{SqlxBinder, SqlxValues};
|
||||
use tracing::instrument;
|
||||
|
||||
use crate::{
|
||||
@ -215,10 +215,10 @@ impl From<MySqlQueryResult> for ExecResult {
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn sqlx_query(stmt: &Statement) -> sqlx::query::Query<'_, MySql, MySqlArguments> {
|
||||
let mut query = sqlx::query(&stmt.sql);
|
||||
pub(crate) fn sqlx_query(stmt: &Statement) -> sqlx::query::Query<'_, MySql, SqlxValues> {
|
||||
if let Some(values) = &stmt.values {
|
||||
query = bind_query(query, values);
|
||||
sqlx::query_with(&stmt.sql, SqlxValues(values.clone()))
|
||||
} else {
|
||||
sqlx::query_with(&stmt.sql, SqlxValues(Values(Vec::new())))
|
||||
}
|
||||
query
|
||||
}
|
||||
|
@ -1,12 +1,12 @@
|
||||
use sea_query::Values;
|
||||
use sea_query_binder::SqlxValues;
|
||||
use std::{future::Future, pin::Pin, sync::Arc};
|
||||
|
||||
use sqlx::{
|
||||
postgres::{PgArguments, PgConnectOptions, PgQueryResult, PgRow},
|
||||
postgres::{PgConnectOptions, PgQueryResult, PgRow},
|
||||
PgPool, Postgres,
|
||||
};
|
||||
|
||||
sea_query::sea_query_driver_postgres!();
|
||||
use sea_query_driver_postgres::bind_query;
|
||||
use tracing::instrument;
|
||||
|
||||
use crate::{
|
||||
@ -215,10 +215,10 @@ impl From<PgQueryResult> for ExecResult {
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn sqlx_query(stmt: &Statement) -> sqlx::query::Query<'_, Postgres, PgArguments> {
|
||||
let mut query = sqlx::query(&stmt.sql);
|
||||
pub(crate) fn sqlx_query(stmt: &Statement) -> sqlx::query::Query<'_, Postgres, SqlxValues> {
|
||||
if let Some(values) = &stmt.values {
|
||||
query = bind_query(query, values);
|
||||
sqlx::query_with(&stmt.sql, SqlxValues(values.clone()))
|
||||
} else {
|
||||
sqlx::query_with(&stmt.sql, SqlxValues(Values(Vec::new())))
|
||||
}
|
||||
query
|
||||
}
|
||||
|
@ -1,3 +1,4 @@
|
||||
use sea_query::Values;
|
||||
use std::{future::Future, pin::Pin, sync::Arc};
|
||||
|
||||
use sqlx::{
|
||||
@ -5,8 +6,7 @@ use sqlx::{
|
||||
Sqlite, SqlitePool,
|
||||
};
|
||||
|
||||
sea_query::sea_query_driver_sqlite!();
|
||||
use sea_query_driver_sqlite::bind_query;
|
||||
use sea_query_binder::SqlxValues;
|
||||
use tracing::instrument;
|
||||
|
||||
use crate::{
|
||||
@ -222,10 +222,10 @@ impl From<SqliteQueryResult> for ExecResult {
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn sqlx_query(stmt: &Statement) -> sqlx::query::Query<'_, Sqlite, SqliteArguments> {
|
||||
let mut query = sqlx::query(&stmt.sql);
|
||||
pub(crate) fn sqlx_query(stmt: &Statement) -> sqlx::query::Query<'_, Sqlite, SqlxValues> {
|
||||
if let Some(values) = &stmt.values {
|
||||
query = bind_query(query, values);
|
||||
sqlx::query_with(&stmt.sql, SqlxValues(values.clone()))
|
||||
} else {
|
||||
sqlx::query_with(&stmt.sql, SqlxValues(Values(Vec::new())))
|
||||
}
|
||||
query
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user