Fork me on GitHub
#honeysql
<
2022-11-16
>
orestis07:11:12

Hm, we have a utility function

(defn cast-ids [ids]
  [:cast [:lift (mapv str ids)]
   [:raw "mongo_id[]"]])
Where the interesting thing is the :lift that passes in the whole CLJ vector as a single parameter, which somewhere down the stack is converted in a PG array

emccue15:11:49

What does :lift do?

emccue15:11:43

and q. specific to your example - what is a mongo_id[]? do you have a custom type in postgres?

orestis16:11:28

Re mongo_id, yes, it’s a custom type - so we cast to an array of those.

orestis16:11:29

:lift will, IIRC, instruct honey sql to treat the argument as a single value and to not infer anything from the values type - it’s a honey sql2 thing.

orestis16:11:45

I think that array would better than lift

emccue17:11:30

i might be on honeysql 1...

orestis20:11:58

Ah, the docs say that honeysql has “value” for something equivalent - we upgraded all of our code to honeysql2 a couple of months back.

orestis07:11:39

Another instance:

{:select [:*]
   :from [:statuses]
   :where [[:= :title [:any [:lift (into-array status-titles)]]]]}

orestis07:11:31

We don't really use :in in many places @emccue