For example I repeatedly have a bunch of filtering queries of the form:
SELECT * FROM foo WHERE coalesce(c1 = :c1, true) AND coalesce(c2 = :c2, true) ...AND coalesce(cN = :cN, true)
The problem then that I have to pass the full keyword list [c1: nil, c2: nil, ...cN: "bebebe"] to the runner each and every time I use the query.
I would instead rather pass simpler [cN: "bebebe"] at application level. And have the library doing kinda boring args ++ [c1: nil, c2: nil, ...cN: nil] in private. I believe it is possible since the library does know (right?) the set of parameter names.
To distinguish from a truly mandatory parameter I'd propose using either :name:nil (drawback that nil is not an sql term) or :?name.
Was I clear? Do you think it's feasible? possible?
Hi!
I wonder can we have the subj?
For example I repeatedly have a bunch of filtering queries of the form:
The problem then that I have to pass the full keyword list
[c1: nil, c2: nil, ...cN: "bebebe"]
to the runner each and every time I use the query.I would instead rather pass simpler
[cN: "bebebe"]
at application level. And have the library doing kinda boringargs ++ [c1: nil, c2: nil, ...cN: nil]
in private. I believe it is possible since the library does know (right?) the set of parameter names.To distinguish from a truly mandatory parameter I'd propose using either
:name:nil
(drawback thatnil
is not an sql term) or:?name
.Was I clear? Do you think it's feasible? possible?
TIA