diff --git a/CHANGELOG.md b/CHANGELOG.md index 79574c0..d38281d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Changes +* 2.4.next in progress + * Address [#489](https://github.com/seancorfield/honeysql/issues/489) by adding more examples around `:update`. + * 2.4.1033 -- 2023-05-22 * Tentative [ClojureCLR](https://github.com/clojure/clojure-clr) support. * Improve `on-conflict` helper docstring [#490](https://github.com/seancorfield/honeysql/pull/490) [@holyjak](https://github.com/holyjak). diff --git a/doc/clause-reference.md b/doc/clause-reference.md index 49e5544..67ce8dd 100644 --- a/doc/clause-reference.md +++ b/doc/clause-reference.md @@ -621,6 +621,16 @@ user=> (sql/format {:update :transport ["UPDATE transport SET name = ? WHERE id = ?" "Yacht" 2] ``` +You can also set columns to `NULL` or to their default values: + +```clojure +user=> (sql/format {:update :transport + :set {:owner nil, :date_built [:default]} + :where [:= :id 2]}) +["UPDATE transport SET owner = NULL, date_built = DEFAULT WHERE id = ?" + 2] +``` + ## delete, delete-from `:delete-from` is the simple use case here, accepting just a