This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-07-28
Channels
- # asami (1)
- # aws (9)
- # babashka (16)
- # beginners (32)
- # calva (2)
- # clj-kondo (20)
- # cljdoc (6)
- # clojure (35)
- # clojure-dev (25)
- # clojure-europe (11)
- # clojure-india (1)
- # clojure-norway (2)
- # clojure-spec (26)
- # clojure-uk (1)
- # clojurescript (41)
- # conjure (3)
- # css (9)
- # cursive (18)
- # data-oriented-programming (6)
- # data-science (2)
- # emacs (47)
- # events (1)
- # fulcro (15)
- # graalvm (30)
- # gratitude (7)
- # honeysql (27)
- # inf-clojure (4)
- # introduce-yourself (2)
- # lsp (129)
- # malli (7)
- # missionary (21)
- # nbb (17)
- # off-topic (18)
- # re-frame (6)
- # releases (1)
- # shadow-cljs (120)
- # vim (7)
- # xtdb (15)
I have a fun little issue
this assertion is tripping me up https://github.com/seancorfield/honeysql/blob/v2.2.891/src/honey/sql/helpers.cljc#L1031-L1036
specifically I have a library that registers a clause before honeysql helpers are loaded
and so this assertion fails
you can open a repl using clj -Sdeps '{:deps {com.github.seancorfield/honeysql {:mvn/version "2.2.891"}}}'
and then use this to trigger the assertion error
(require '[honey.sql :as sql]
'[clojure.string :as str])
(sql/register-clause!
:on
(fn [_ [table & columns]]
[(str (sql/sql-kw :on)
" "
(sql/format-entity table)
"("
(str/join ", "
(mapcat sql/format-expr columns))
")")])
nil)
(require '[honey.sql.helpers :as sql.helpers])
I'll file an issue
and maybe do a PR
I ran into this because I have non-helper-generated clauses that I need to merge and wanted to use the helpers to do it
it would be super nice to have a merge that would merge each of the clause types between two maps
but I'll definitely work something out in my app before considering contributing it back
@corasaurus-hex It would probably be better to add a builtin-base-clause-order
and use that in the assert
and have base-clause-order
initialized from that new sequence?
https://github.com/corasaurus-hex/honeysql/blob/d802d885e914aae69c8d2c804e0e89dd258b38fe/src/honey/sql.cljc#L928-L932 it looks like we already have this as default-clause-order
Hmm, yeah, I just happened to have that file open right now, looking at another issue. I wonder why I set up the assert on the mutable clause order instead of the base one...?
So I think I can just change that one line in the assert and we're all good @corasaurus-hex?
I'll bet you started with base-clause-order
or current-clause-order
and then needed to re-use the same starting structure with the other var, giving you default-clause-order
I just pushed up to that branch
if you'd rather just merge
Heh, I already made the one word change locally but I'll check your PR and take that instead 🙂
thanks 😄
Updated changelog. There should be a new SNAPSHOT up on Clojars shortly that you can use, or via git deps. I have a few more problems to solve before I release 2.3.x...
Much appreciated -- that's a really interesting edge case to have detected. Thank you!
(so the builtin list never changes -- and then the assert correctly reflects the internal consistency that is needed there)
sure, that would work