Created
July 25, 2009 19:14
-
-
Save angerman/154862 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
(def *filters* {'= Query$FilterOperator/EQUAL | |
'> Query$FilterOperator/GREATER_THAN | |
'>= Query$FilterOperator/GREATER_THAN_OR_EQUAL | |
'< Query$FilterOperator/LESS_THAN | |
'<= Query$FilterOperator/LESS_THAN_OR_EQUAL}) | |
;; query kind where (= :name x) | |
;; -> (.addFilter (Query. "Item") :name ('= *filters*) x) | |
(defmacro query [kind _ filters] `(.addFilter (Query. ~kind) | |
~(name (nth filters 1)) | |
((first '~filters) *filters*) | |
~(last filters))) | |
;; additionally if something like would be supported would be great | |
;; query kind where [(= :name x) (= :key y)] | |
;; but if there is a more lispy way to do the query I'm very eager to learn |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment