Fork me on GitHub

I might be missing something in the docs, but is there a way to get back a single column SELECT as a seq of values instead of a seq of maps each with one key, value? :raw didn't seem to do it in the next-jdbc adapter.


I just end up throwing the maps away, and I'd like to get rid of that overhead.


You can use :raw, but you also have to consider what the underlying library is returning. The 4th argument of your hugsql-defined function takes options and sends them along to the underlying library. In, you could send along {:as-arrays? true} for a result like [["id"] [1] [2] [3]] . I suspect there is a similar option for next.jdbc.


It occurs to me that the arrays returned here aren't much better than the maps, since you still have to take the first item (columns) off and then the first of each vector. So, it's either (flatten (rest x)) for this return value, or (map :id x) for the maps.


oh this is great. Somehow I missed that there are extra arities to the hugsql functions. You're right, though, array of arrays versus array of maps isn't much different but I'll see what I could do to get array of string.


in the end it's probably fine for the use I'm working on right now, but this is great to know about in future.