Skip to content

Commit

Permalink
Add example for SET NULL
Browse files Browse the repository at this point in the history
  • Loading branch information
tyt2y3 committed Nov 27, 2024
1 parent b91ba14 commit ff8f58a
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/query/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,24 @@ impl UpdateStatement {
/// query.to_string(SqliteQueryBuilder),
/// r#"UPDATE "glyph" SET "aspect" = 60 * 24 * 24, "image" = '24B0E11951B03B07F8300FD003983F03F0780060'"#
/// );
///
/// let query = Query::update()
/// .table(Glyph::Table)
/// .value(Glyph::Aspect, Expr::value(Value::Int(None)))
/// .to_owned();
///
/// assert_eq!(
/// query.to_string(MysqlQueryBuilder),
/// r#"UPDATE `glyph` SET `aspect` = NULL"#
/// );
/// assert_eq!(
/// query.to_string(PostgresQueryBuilder),
/// r#"UPDATE "glyph" SET "aspect" = NULL"#
/// );
/// assert_eq!(
/// query.to_string(SqliteQueryBuilder),
/// r#"UPDATE "glyph" SET "aspect" = NULL"#
/// );
/// ```
pub fn value<C, T>(&mut self, col: C, value: T) -> &mut Self
where
Expand Down

0 comments on commit ff8f58a

Please sign in to comment.