Skip to content

Commit

Permalink
fixes #414
Browse files Browse the repository at this point in the history
  • Loading branch information
seancorfield committed Jul 15, 2022
1 parent 16ce2e8 commit 8e72cb8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Changes

* 2.3.next in progress
* Address [#414](https://github.com/seancorfield/honeysql/issues/414) by providing an example of `ORDER BY` with a `CASE` expression.
* Address [#412](https://github.com/seancorfield/honeysql/issues/412) by documenting options in a separate page and reorganizing the ToC structure.
* Address [#409](https://github.com/seancorfield/honeysql/issues/409) by making docstring check for public helpers conditional.
* Address [#401](https://github.com/seancorfield/honeysql/issues/401) by adding `register-dialect!` and `get-dialect`, and also making `add-clause-before`, `strop`, and `upper-case` public so that new dialects are easier to construct.
Expand Down
6 changes: 6 additions & 0 deletions doc/clause-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -815,6 +815,12 @@ user=> (sql/format {:select [:*] :from :table
;; expression without direction is still wrapped:
:order-by [:status, [[:year :created-date]]]})
["SELECT * FROM table ORDER BY status ASC, YEAR(created_date) ASC"]
;; a more complex order by with case (and direction):
user=> (sql/format {:select [:*] :from :table
:order-by [[[:case [:< [:now] :expiry-date]
:created-date :else :expiry-date]
:desc]]})
["SELECT * FROM table ORDER BY CASE WHEN NOW() < expiry_date THEN created_date ELSE expiry_date END DESC"]
```

## limit, offset, fetch
Expand Down

0 comments on commit 8e72cb8

Please sign in to comment.