Having trouble getting a snippet to work. Am I writing it incorrectly?
-- :snip example-snip
SELECT :id AS "foo/id"
-- :name get-client-by-core-id :query :one
-- :doc Fetch a client by core client id
:snip:example-snip
FROM clients
where core_client_id = :foo/core-client-id;
Getting exception Parameter Mismatch: :example-snip parameter data not found.
Using this with conman.What does your function call look like?
(db/get-client-by-core-id query-args)
It has the same form as it did before I tried converting to snippets.
Snippets have their own set of parameters, so the query args should have a {:example-snip {:id 1}}
. You probably want something like fragments, but those don't exist yet: https://github.com/layerware/hugsql/issues/36
ah, okay. When I was looking at the snippets doc, I thought the snip-query example was focused on explaining use of the
-- :snip cond-snip
so didn't look into it too closely.thanks for the help!