fix #485 by adding :with-ordinality operator

This commit is contained in:
Sean Corfield 2023-04-15 11:37:20 -07:00
parent c8d4f58f0d
commit bc66ec5aee
3 changed files with 15 additions and 1 deletions

View file

@ -2,12 +2,14 @@
* 2.4.next in progress * 2.4.next in progress
* Fix [#486](https://github.com/seancorfield/honeysql/issues/486) by supporting ANSI-style `INTERVAL` syntax. * Fix [#486](https://github.com/seancorfield/honeysql/issues/486) by supporting ANSI-style `INTERVAL` syntax.
* Fix [#485](https://github.com/seancorfield/honeysql/issues/485) by adding `:with-ordinality` "operator".
* Fix [#484](https://github.com/seancorfield/honeysql/issues/484) by adding `TABLE` to `TRUNCATE`. * Fix [#484](https://github.com/seancorfield/honeysql/issues/484) by adding `TABLE` to `TRUNCATE`.
* Fix [#483](https://github.com/seancorfield/honeysql/issues/483) by adding a function-like `:join` syntax to produce nested `JOIN` expressions. * Fix [#483](https://github.com/seancorfield/honeysql/issues/483) by adding a function-like `:join` syntax to produce nested `JOIN` expressions.
* 2.4.1011 -- 2023-03-23 * 2.4.1011 -- 2023-03-23
* Address [#481](https://github.com/seancorfield/honeysql/issues/481) by adding more examples around `:do-update-set`. * Address [#481](https://github.com/seancorfield/honeysql/issues/481) by adding more examples around `:do-update-set`.
* Address [#480](https://github.com/seancorfield/honeysql/issues/480) by clarifying the general relationship between clauses and helpers. * Address [#480](https://github.com/seancorfield/honeysql/issues/480) by clarifying the general relationship between clauses and helpers.
* Address [#448](https://github.com/seancorfield/honeysql/issues/448) by adding a new section with hints and tips for database-specific syntax and solutions. * Address [#448](https://github.com/seancorfield/honeysql/issues/448) by adding a new section with hints and tips for database-specific syntax and solutions.
* Update `tools.build`; split alias `:test`/`:runner` for friendlier jack-in UX while developing.
* 2.4.1006 -- 2023-03-17 * 2.4.1006 -- 2023-03-17
* Fix [#478](https://github.com/seancorfield/honeysql/issues/478) by handling `:do-update-set` correctly in the `upsert` helper and by handling parameters correctly in the `:do-update-set` formatter. * Fix [#478](https://github.com/seancorfield/honeysql/issues/478) by handling `:do-update-set` correctly in the `upsert` helper and by handling parameters correctly in the `:do-update-set` formatter.

View file

@ -120,6 +120,17 @@ as an alias for `regexp`.
`similar-to` and `not-similar-to` are also supported. `similar-to` and `not-similar-to` are also supported.
## with ordinality
The ANSI SQL `WITH ORDINALITY` expression is supported as an infix operator:
```clojure
{...
[:with-ordinality [:jsonb_array_elements :j] [:arr :item :index]]
...}
;;=> ["...JSONB_ARRAY_ELEMENTS(j) WITH ORDINALITY ARR(item, index)..."]
```
## || ## ||
String concatenation operator. String concatenation operator.

View file

@ -1323,7 +1323,8 @@
(-> #{"mod" "and" "or" "xor" "<>" "<=" ">=" "||" "<->" (-> #{"mod" "and" "or" "xor" "<>" "<=" ">=" "||" "<->"
"like" "not-like" "regexp" "~" "&&" "like" "not-like" "regexp" "~" "&&"
"ilike" "not-ilike" "similar-to" "not-similar-to" "ilike" "not-ilike" "similar-to" "not-similar-to"
"is" "is-not" "not=" "!=" "regex"} "is" "is-not" "not=" "!=" "regex"
"with-ordinality"}
(into (map str "+-*%|&^=<>")) (into (map str "+-*%|&^=<>"))
(into (keys infix-aliases)) (into (keys infix-aliases))
(into (vals infix-aliases)) (into (vals infix-aliases))