Fork me on GitHub

Hi there! I’m wondering if there’s any way to access a composite type (as in ) with honeysql? Re the linked example: as I’m not able to use :(item).name, is there any alternative way to express (item).name? (I could only find how to compose a composite type in the docs; any way to decompose it would be useful.)


I suspect (keyword "(item)" "name") would work (but that's pretty ugly). I'd probably define :. as special syntax:

dev=> (sql/register-fn! :. (fn [_ [x y]] [(str "(" (sql/format-entity x) ")." (sql/format-entity y))]))
dev=> (sql/format-expr [:. :item :name])
Maybe (sql/format-expr x) if that can be an expression -- but that returns [sql & params] so you'd need a more complex formatted...

👍 4

@marcus.josefsson ☝️:skin-tone-2: Does that help?


It does - many thanks for the help!