Try typed mull value SeaQL/sea-query#107
This commit is contained in:
parent
318fa9f9bf
commit
caa85d7fba
@ -33,7 +33,7 @@ futures = { version = "^0.3" }
|
|||||||
futures-util = { version = "^0.3" }
|
futures-util = { version = "^0.3" }
|
||||||
rust_decimal = { version = "^1", optional = true }
|
rust_decimal = { version = "^1", optional = true }
|
||||||
sea-orm-macros = { version = "^0.1", path = "sea-orm-macros", optional = true }
|
sea-orm-macros = { version = "^0.1", path = "sea-orm-macros", optional = true }
|
||||||
sea-query = { version = "^0.14", features = ["thread-safe"] }
|
sea-query = { version = "^0.14", features = ["thread-safe"], git = "https://github.com/SeaQL/sea-query.git", branch = "typed-null-value" }
|
||||||
sea-strum = { version = "^0.21", features = ["derive", "sea-orm"] }
|
sea-strum = { version = "^0.21", features = ["derive", "sea-orm"] }
|
||||||
serde = { version = "^1.0", features = ["derive"] }
|
serde = { version = "^1.0", features = ["derive"] }
|
||||||
sqlx = { version = "^0.5", optional = true }
|
sqlx = { version = "^0.5", optional = true }
|
||||||
|
@ -425,7 +425,7 @@ pub trait EntityTrait: EntityName {
|
|||||||
/// # let _: Result<(), DbErr> = smol::block_on(async {
|
/// # let _: Result<(), DbErr> = smol::block_on(async {
|
||||||
/// #
|
/// #
|
||||||
/// let update_result = fruit::Entity::update_many()
|
/// let update_result = fruit::Entity::update_many()
|
||||||
/// .col_expr(fruit::Column::CakeId, Expr::value(Value::Null))
|
/// .col_expr(fruit::Column::CakeId, Expr::value(Value::Int(None)))
|
||||||
/// .filter(fruit::Column::Name.contains("Apple"))
|
/// .filter(fruit::Column::Name.contains("Apple"))
|
||||||
/// .exec(&db)
|
/// .exec(&db)
|
||||||
/// .await?;
|
/// .await?;
|
||||||
@ -438,7 +438,7 @@ pub trait EntityTrait: EntityName {
|
|||||||
/// assert_eq!(
|
/// assert_eq!(
|
||||||
/// db.into_transaction_log(),
|
/// db.into_transaction_log(),
|
||||||
/// vec![Transaction::from_sql_and_values(
|
/// vec![Transaction::from_sql_and_values(
|
||||||
/// DbBackend::Postgres, r#"UPDATE "fruit" SET "cake_id" = $1 WHERE "fruit"."name" LIKE $2"#, vec![Value::Null, "%Apple%".into()]
|
/// DbBackend::Postgres, r#"UPDATE "fruit" SET "cake_id" = $1 WHERE "fruit"."name" LIKE $2"#, vec![Value::Int(None), "%Apple%".into()]
|
||||||
/// )]);
|
/// )]);
|
||||||
/// ```
|
/// ```
|
||||||
fn update_many() -> UpdateMany<Self> {
|
fn update_many() -> UpdateMany<Self> {
|
||||||
|
@ -129,7 +129,7 @@
|
|||||||
//!
|
//!
|
||||||
//! // update many: UPDATE "fruit" SET "cake_id" = NULL WHERE "fruit"."name" LIKE '%Apple%'
|
//! // update many: UPDATE "fruit" SET "cake_id" = NULL WHERE "fruit"."name" LIKE '%Apple%'
|
||||||
//! Fruit::update_many()
|
//! Fruit::update_many()
|
||||||
//! .col_expr(fruit::Column::CakeId, Expr::value(Value::Null))
|
//! .col_expr(fruit::Column::CakeId, Expr::value(Value::Int(None)))
|
||||||
//! .filter(fruit::Column::Name.contains("Apple"))
|
//! .filter(fruit::Column::Name.contains("Apple"))
|
||||||
//! .exec(db)
|
//! .exec(db)
|
||||||
//! .await?;
|
//! .await?;
|
||||||
|
@ -232,7 +232,7 @@ mod tests {
|
|||||||
fn update_4() {
|
fn update_4() {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
Update::many(fruit::Entity)
|
Update::many(fruit::Entity)
|
||||||
.col_expr(fruit::Column::CakeId, Expr::value(Value::Null))
|
.col_expr(fruit::Column::CakeId, Expr::value(Value::Int(None)))
|
||||||
.filter(fruit::Column::Id.eq(2))
|
.filter(fruit::Column::Id.eq(2))
|
||||||
.build(DbBackend::Postgres)
|
.build(DbBackend::Postgres)
|
||||||
.to_string(),
|
.to_string(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user