Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

-> and ->> in datomic queries #243

Open
jramosg opened this issue Jun 17, 2021 · 0 comments
Open

-> and ->> in datomic queries #243

jramosg opened this issue Jun 17, 2021 · 0 comments

Comments

@jramosg
Copy link

jramosg commented Jun 17, 2021

Hello,

I detected this issue, I think that this should not be suggested:

Consider using:
  (?uuids ?uuid)
instead of:
  (-> ?uuid ?uuids)

This suggestion gives error in datomic queries. For example:

(d/q
  '[:find [?uuid ...]
    :in $  ?uuids
    :where
    [?u :user/uuid ?uuid]
    [(-> ?uuid ?uuids)]]
  (d/db conn) #{"1" "2"})
=> ["1"]

The error

(d/q
  '[:find [?uuid ...]
    :in $ ?uuids
    :where
    [?u :user/uuid ?uuid]
    [(?uuids ?uuid)]]
  (d/db conn) #{"1" "2"})

CompilerException java.lang.RuntimeException: Unable to resolve symbol: ?uuids in this context, compiling:(/private/var/folders/9l/9jbpng7x7_j1jkm5l7gh1zg80000gn/T/form-init10140150991526075454.clj:6:6) 

The plugin suggests this, but datomic does not accepted. I think it could be okay to look if it is inside a datomic query to avoid it.

(def ?uuids #{"1" "2"})
(?uuids "2")
=> "2"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant