honeysql

Discussion of https://github.com/seancorfield/honeysql :slightly_smiling_face:
p-himik 2020-08-03T18:40:34.333500Z

Is there an easy way to use (sql/call :position ...) in such a way so that the ... part specifies an inline parameter (i.e. one that doesn't require passing it explicitly to sql/format) and that the resulting SQL is position(? IN my_column)? Since I can't use sql/param, seems like the simplest way is to just add a custom function formatter.

p-himik 2020-08-03T18:42:30.333600Z

But maybe it's worthwhile to have some generic mechanism to support such functions that have to use some keywords inside (). PostgreSQL has many of them - position, trim, substring, overlay,...

seancorfield 2020-08-03T18:58:43.333800Z

@p-himik It's definitely harder today than it should be -- this is another one of those things I want to attack in HoneySQL 2.0.

p-himik 2020-08-03T19:01:37.334Z

Wonderful! I'm gonna use this opportunity to mention a couple of other things: - Check that the value passed to sql/param is actually present in the parameters map - Automatically dedupe parameter values with identical? Do you have any thoughts?

seancorfield 2020-08-03T19:59:39.334200Z

Feel free to create issues on GitHub -- I don't have cycles to think about those at the moment.

👍 1