Hey all, does anyone have tips or advice with regards to migrating from yesql to hugsql? From what I've seen hugsql queries only accept parameters as maps and yesql takes positional arguments, so the task is slightly sisyphic . Any tips or advice will be welcome 🙂
@ben.sless you could write a program to manipulate the SQL files, just looking for ?
tokens, then replacing them with :arg1, :arg2, and so on
I think you should just need to track if you are inside a comment or string literal
Thank you @isak, the good part is that the original author already used named arguments in the queries. The bad part is that yesql defines fns whose arguments are positional (yet still with the correct name, i.e. (query1 param1 param2 ...)), while hugsql defines a map argument, (query1 {:param1 v1 ...}). That's the annoying part of migrating. I wrote a hacky macro which wraps a yesql form and converts it to a hugsql form, but it's fragile and I'd rather not use it =\
@ben.sless Ah I see, a little harder. Then maybe you have to write a program to process the .clj files. (Maybe using this: https://github.com/xsc/rewrite-clj )