honeysql

lepistane 2024-08-25T19:42:48.881809Z

is it possible to configure sql/format in such a way so that it transforms the column names from kebab-case to camelCase? DB model is camel.. (not something i can control)

seancorfield 2024-08-25T19:46:49.678649Z

You can use :'camelCase to produce "as-is" column names.

lepistane 2024-08-25T19:49:50.182849Z

Sorry but how exactly do i use it? Or where can i look up documentation/examples about it?

seancorfield 2024-08-25T19:50:05.183119Z

user=> (sql/format {:select [:'thisCol :'thatCol] :from :'myTable :where [:= :'theID 42]})
["SELECT thisCol, thatCol FROM myTable WHERE theID = ?" 42]

👍 1
lepistane 2024-08-25T19:50:38.254809Z

What do i do in the context of

{:insert-into [:x]
 :values [data]}
? where data is kebab-cased

seancorfield 2024-08-25T19:54:20.930539Z

You'd have to use something like update-keys data csk/->camelCase I guess https://clj-commons.org/camel-snake-kebab/

👍 1
seancorfield 2024-08-25T19:54:45.659129Z

Or use next.jdbc.sql/insert! which supports CSK directly.

👍 1
lepistane 2024-08-25T19:59:08.129179Z

Thank you very much