sql 2024-10-07

if i have date values that has to be inserted into the database wth honeysql what do i have to do than?

Just pass them into parameters as usual. Dates are natively supported by jdbc.

hrm strange i get the following issue

ERROR: column "end_date" is of type date but expression is of type character varying
  Hint: You will need to rewrite or cast the expression.
  Position: 181

end date is transfered from my form

end_date "2024-10-08"

it means, you have date column in the db, but you pass a string. Either coerce string into Date, or LocalDate object, or use ::date coercion in your sql

so it should be sufficient to use the string and create a date object out of it right

If the string has all the relevant data - yes. And since your question is about HoneySQL (BTW there's #honeysql), you can do the cast with [:cast the-value :date].

ok but it would be simple i guess converting the value directly

Depends on what you mean by "simple". :) If your connection is HTTP, dates will be converted to strings anyway, as far as I'm aware.

Exactly like that i wanted to grep the form params and assoc new values to the date fields by using LocalDate/parse on the given string from the params