Skip to content

-> and ->> in datomic queries #243

Open
@jramosg

Description

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"

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions