honeysql 2024-08-25

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)

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

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

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

👍 1

What do i do in the context of

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

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

👍 1

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

👍 1

Thank you very much