This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-06-23
Channels
- # announcements (16)
- # asami (4)
- # babashka (49)
- # beginners (70)
- # calva (25)
- # clojars (3)
- # clojure (40)
- # clojure-europe (82)
- # clojure-france (15)
- # clojure-gamedev (16)
- # clojure-nl (2)
- # clojured (7)
- # clojurescript (13)
- # conjure (11)
- # cursive (4)
- # data-science (12)
- # datalevin (2)
- # figwheel-main (5)
- # gratitude (5)
- # honeysql (5)
- # hyperfiddle (4)
- # jobs (4)
- # joyride (3)
- # lsp (10)
- # malli (2)
- # missionary (14)
- # nbb (2)
- # off-topic (3)
- # pathom (16)
- # rdf (5)
- # releases (4)
- # sci (35)
- # shadow-cljs (16)
- # tools-deps (22)
- # xtdb (7)
What’s the best way to cast a select result to a string in honeysql? Say, my raw SQL is SELECT ID FROM TABLE;
where ID is a UUID. I want to cast that to a string or varchar type.
Probably depends on your database. HoneySQL just creates queries out of Clojure data structures. For Postgres:
(hh/select [[[:cast :did :text]] :did-as-txt])
Cool, thanks! I also did a little experimentation and discovered:
[(hsql/raw "row.id::text") :row_id]
👍 1
That looks like HoneySQL v1? For anyone else reading this thread, in HoneySQL v2, :raw
is a "function" now, [:raw "row.id::text"]
Yeah, that’s v1. Good callout. Thanks!