I communicate my EQL query in string, for example: "[{[:user/id 1] [:user/name]}]"
then I read-string
it, and I give to p.eql/process
. The problem is when I try to read-string
something like:
[`(save-file {::file-path "./file.txt" ::file-content "contents here"})]
then the result is not what I expected. Are there some alternatives for read-string
to resolve this?@paul931224
First, use clojure.edn/read-string
. The clojure.core/read-string
is a "Lisp Reader" e can evaluate things:
user=> (read-string "#=(prn :exec)")
:exec
nil
user=>
second, ::file-path
is not part of edn
spec, it's a clojure shortcut.
In edn
it should be something like :some.namespace-name/file-path
If you do (pr-str [::my-kw])
it will result in the "[:user/my-kw]"
string, that is a valid EDN.
Some custom EDN readers like edamame
allow you to read qualified keywords, but I don't think that it's a good idea for an EQL API