Is the following expected behavior?
(defn naive-find-username-eid [username-string]
(d/q `[:find ?e
:where
[?e :user/username ~username-string]]
@conn))
(naive-find-username-eid nil) ;; => #{[774]}
When provided nil , naive-find-username-eid will return the eid for (the first and only) user in my system.Thanks timo
Take a look at https://docs.datomic.com/query/query-data-reference.html#inputs though not related to your specific problem.
I think the above behavior makes sense. I am probably writing non-idiomatic code. To adjust, I re-wrote my fn as follows:
(defn find-username-eid [username-string]
(if-not (nil? username-string)
(ffirst
(d/q `[:find ?e
:where
[?e :user/username ~username-string]]
@conn))))
But I thought it was interesting — my first time revising my expectations of the concept of nil :)