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.
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
,...
@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.
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?
Feel free to create issues on GitHub -- I don't have cycles to think about those at the moment.