Just looking over https://stackoverflow.com/questions/58188746/nested-namespaced-keys-in-hugsql-query and it seems like you can either have a namespaced keyword or a dotted-path (for a deep get) so the usage in the question isn't possible. Is my reading of the source correct?
I tried a variety of things and could not get a namespace-qualified keyword to work at all tho'...
Given
-- :name char-by-nested-id :? :1
-- :doc Get character by nested id
select * from characters
where id = :value:model.person/id
I would have expected user=> (ex/char-by-nested-id-sqlvec {} {:model.person/id 42})
to work but I get Execution error (ExceptionInfo) at hugsql.core/validate-parameters! (core.clj:83).
Parameter Mismatch: :model.person/id parameter data not found.
What am I doing wrong?The sqlvec function params should be the first argument.
Oh. I expected it to match the signature of the non-`sqlvec` function. Silly me 🙂
OK, so the SO Q's answer is that HugSQL doesn't support nested qualified keywords because .
in the name portion means deep get?
The top-level key can be qualified, so where id = :value:model.person/primary.id
would work for {:model.person/primary {:id 42}}
(tested it and, yes, that works)
hmm...I guess that is true. Maybe deep-get really needs another syntax moving forward.
The logic merged in that PR only deals with /
in the first position of the dot-separated things
And you can't have :a.b/c.d
as a single keyword (even tho' it is valid in Clojure).
If it's any help, what Selmer does is use ..
as an escape for the .
in a keyword.
So where id = :value:model..person/primary.model..person/id
would be Selmer's way of drilling down into nested qualified keys.
Maybe you can respond to that SO question? (or I can, if you want)
either way...it'll have to be later for me. Thanks for the selmer tip...that seems like a way forward, though I might have to put in a flag to allow the old behavior.
I gave an answer on SO https://stackoverflow.com/a/58190586/3743091