-
-
Save boxxxie/09bf48ebdfcfc0f99433 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 find-by-lcode-name [lcode-name db] | |
(flatten (d/q '[:find ?e | |
:in $ ?lcode-name | |
:where | |
[?e :place/lcode_name ?lcode-name] | |
] | |
db lcode-name))) | |
(testing "testing the query on an empty dataset" | |
(let [db [[]] | |
found-by-lcode (find-by-lcode-name 0 db) | |
] | |
(is (not (seq found-by-lcode))))) | |
;;this throws | |
;;ERROR in (find-by-lcode-name-q-unit) (datalog.clj:935) | |
;;Uncaught exception, not in assertion. | |
;;expected: nil | |
;; actual: java.lang.Exception: processing rule: (q__6245 ?e) | |
;; at datomic.datalog$eval_rule$fn__6735.invoke (datalog.clj:935) | |
;; datomic.datalog$eval_rule.invoke (datalog.clj:915) | |
;; datomic.datalog$eval_query.invoke (datalog.clj:957) | |
;; datomic.datalog$qsqr.invoke (datalog.clj:1011) | |
;; datomic.datalog$qsqr.invoke (datalog.clj:979) | |
;; datomic.query$q.invoke (query.clj:448) | |
;; datomic.api$q.doInvoke (api.clj:31) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment