hugsql

Joseph Graham 2022-12-05T20:41:20.869649Z

Hello! So to avoid having to convert the data type at the Clojure level I'm frequently setting the type of my ids using hugsql integer, for example

- :name list-all-tasks :? :*
-- :doc list all task deets for a page
select * from task
where page_ref = :page_ref::integer
However, not sure how I can do that with a vector like:
(:v*:task_ids)

lukasz 2022-12-05T21:42:48.549929Z

I'm afk but doesn't (:v*:task_ids::integer) work?

curtis.summers 2022-12-06T01:57:43.019599Z

If you're using postgresql, instead of page_ref in (:v*:task_ids) use page_ref = any(array[:v*:task_ids]::integer[]).

Joseph Graham 2022-12-06T06:30:03.724189Z

That works Curtis. Great!