Original query:
-- :name select*-list
-- :command :query
-- :result :raw
-- :doc Select all lists.
-- parameters()
SELECT * FROM list;
I want to pass in arbitrary key/val pairs and get matching results. For example:
(select*-list db-spec {:name "Fruit" :type "Foo"})
should result in:
SELECT * FROM list
WHERE name = 'Fruit'
AND type = 'Foo';
I can think of a few ugly ways to accomplish this but it's likely I'm overlooking some nice way to do this.
JDBC has some great shortcuts out from the box. One of them is find-by-keys. It does exactly what you want: takes a map of key/value pairs and composes a set of
WHEREclauses connected withAND:will turn out to