-
-
Save jcromartie/79667390ab7e2887d065 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn compile-where | |
[record] | |
(let [clause (apply list 'and (map #(list '= (key %) (val %)) record))] | |
`(ql/where ~clause))) | |
(defn match-record | |
[record] | |
(eval (compile-where record))) |
Fixed in Master - The above code will generate a working predicate
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I see that the Predicate protocol doesnt handle empty ANDs gracefully. But if that was fixed, wouldn't this approach be preferred?