This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-02-26
Channels
- # announcements (19)
- # babashka (27)
- # beginners (24)
- # calva (14)
- # clerk (5)
- # clj-commons (21)
- # clojure (51)
- # clojure-europe (14)
- # clojure-madison (1)
- # clojure-nl (1)
- # clojure-norway (9)
- # clojure-uk (4)
- # clojuredesign-podcast (32)
- # core-async (14)
- # datomic (7)
- # events (1)
- # honeysql (3)
- # hyperfiddle (14)
- # introduce-yourself (2)
- # kaocha (7)
- # malli (21)
- # off-topic (50)
- # portal (2)
- # reagent (41)
- # reitit (41)
- # releases (1)
- # scittle (6)
- # shadow-cljs (90)
- # tools-deps (10)
- # xtdb (1)
- # yamlscript (1)
Hello guys... i have a doubt with a query... sorry if this is not the place to ask this kind of things... the query is the following...
(defn candidate-users-with-setting-query
[candidate-id setting-name roles]
(let [query (get-candidate-followers-query candidate-id)]
(cond-> query
(seq roles) (sqlh/merge-where (sql/raw "u.role IN ('admin', 'user')")))))
roles arg is a collection of strings like ("admin" "user") and i want to use it directly like [:in :u.role roles] instead of using sql/raw so i don't have to build the raw string.
The vector sintax doesn't work because role column is an enum type.
Is there a way to cast the collection or make it work that way?
Thanks in advance...> The vector sintax doesn't work because role column is an enum type.
The two things aren't related.
Preparing parameters doesn't work with enums. So you either gotta inline the values in or use casting.
For inlining, just wrap each value in [:inline ...]
.
For casting, you can use [:cast ... :the_enum]
.