But no harm either, it is just whitespace I guess. So you have -- :name <> before the sql statement and it will be recognised?
You can do that if you like. If you're looking to define hugsql statements from strings in a more granular manner, you might also look at db-fn, which will take a HugSQL-flavored SQL statement, a command (e.g. :?), and a result indicator (e.g. :*) and returns an anonymous function. So: (def my-func (hugsql/db-fn "select * from emp" :? :*)) Also, db-run has similar inline capabilities. http://layerware.github.io/hugsql/hugsql.core.html#var-db-fn http://layerware.github.io/hugsql/hugsql.core.html#var-db-run
Thanks @curtis.summers. That seems more like it. Worked. I just called my-func from your example, with the first arg being the map for the connection and the second arg being {} i.e. in the usual way.
@cjmurphy has joined the channel
Is there an example anywhere of using the function def-db-fns-from-string? It takes a string that is an sql statement. But how to specify the name of the function?? In a file I've used -- :name name-of-fn-so-can-call-it. Also presumably you don't put "\n"s in your string.
You can use multilined strings as is. No need to use \n