This commit is contained in:
Billy Chan 2021-08-19 18:17:02 +08:00 committed by Chris Tsang
parent 318fa9f9bf
commit caa85d7fba
4 changed files with 5 additions and 5 deletions

View File

@ -33,7 +33,7 @@ futures = { version = "^0.3" }
futures-util = { version = "^0.3" }
rust_decimal = { version = "^1", 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"] }
serde = { version = "^1.0", features = ["derive"] }
sqlx = { version = "^0.5", optional = true }

View File

@ -425,7 +425,7 @@ pub trait EntityTrait: EntityName {
/// # let _: Result<(), DbErr> = smol::block_on(async {
/// #
/// 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"))
/// .exec(&db)
/// .await?;
@ -438,7 +438,7 @@ pub trait EntityTrait: EntityName {
/// assert_eq!(
/// db.into_transaction_log(),
/// 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> {

View File

@ -129,7 +129,7 @@
//!
//! // update many: UPDATE "fruit" SET "cake_id" = NULL WHERE "fruit"."name" LIKE '%Apple%'
//! 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"))
//! .exec(db)
//! .await?;

View File

@ -232,7 +232,7 @@ mod tests {
fn update_4() {
assert_eq!(
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))
.build(DbBackend::Postgres)
.to_string(),