Skip to content

Commit

Permalink
Add trim
Browse files Browse the repository at this point in the history
  • Loading branch information
ApricotLace committed Aug 4, 2023
1 parent 5e71ca2 commit ee1253e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/zd/datalog.clj
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@

(defn parse-query [q]
(let [xs (->> (str/split q #"\n")
(mapv str/trim)
(remove (fn [s] (or (str/blank? s) (str/starts-with? s "\\")))))
columns (->> xs
(filterv #(re-matches #"^\s?>.*" %))
Expand Down Expand Up @@ -158,7 +159,7 @@

(defn sugar-query [ztx q]
(let [q (parse-query q)
_ (println :q q)
_ (def q q)
idx (:index q)
res (->>
(query ztx (dissoc q :columns :index))
Expand Down
5 changes: 4 additions & 1 deletion test/zd/datalog_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,10 @@ e :title t


(datalog/parse-query q)
(datalog/sugar-query ztx q)

(datalog/sugar-query ztx "
e :parent #people
> e:* ")


)

0 comments on commit ee1253e

Please sign in to comment.