Process Function instances in clause handling. r=nalexander
This commit is contained in:
parent
4c2230929e
commit
fc65f268fa
1 changed files with 29 additions and 2 deletions
|
@ -13,14 +13,35 @@
|
||||||
[datascript.parser :as dp
|
[datascript.parser :as dp
|
||||||
#?@(:cljs
|
#?@(:cljs
|
||||||
[:refer
|
[:refer
|
||||||
[PlainSymbol Predicate Not Or Pattern DefaultSrc Variable Constant Placeholder]])]
|
[
|
||||||
|
Constant
|
||||||
|
DefaultSrc
|
||||||
|
Function
|
||||||
|
Not
|
||||||
|
Or
|
||||||
|
Pattern
|
||||||
|
Placeholder
|
||||||
|
PlainSymbol
|
||||||
|
Predicate
|
||||||
|
Variable
|
||||||
|
]])]
|
||||||
[honeysql.core :as sql]
|
[honeysql.core :as sql]
|
||||||
[clojure.string :as str]
|
[clojure.string :as str]
|
||||||
)
|
)
|
||||||
#?(:clj
|
#?(:clj
|
||||||
(:import
|
(:import
|
||||||
[datascript.parser
|
[datascript.parser
|
||||||
PlainSymbol Predicate Not Or Pattern DefaultSrc Variable Constant Placeholder])))
|
Constant
|
||||||
|
DefaultSrc
|
||||||
|
Function
|
||||||
|
Not
|
||||||
|
Or
|
||||||
|
Pattern
|
||||||
|
Placeholder
|
||||||
|
PlainSymbol
|
||||||
|
Predicate
|
||||||
|
Variable
|
||||||
|
])))
|
||||||
|
|
||||||
;; A ConjoiningClauses (CC) is a collection of clauses that are combined with JOIN.
|
;; A ConjoiningClauses (CC) is a collection of clauses that are combined with JOIN.
|
||||||
;; The topmost form in a query is a ConjoiningClauses.
|
;; The topmost form in a query is a ConjoiningClauses.
|
||||||
|
@ -258,6 +279,9 @@
|
||||||
;; TODO: handle And within the Or patterns.
|
;; TODO: handle And within the Or patterns.
|
||||||
(raise "Non-simple `or` clauses not yet supported." {:clause orc})))
|
(raise "Non-simple `or` clauses not yet supported." {:clause orc})))
|
||||||
|
|
||||||
|
(apply-function-clause [cc function]
|
||||||
|
cc)
|
||||||
|
|
||||||
;; We're keeping this simple for now: a straightforward type switch.
|
;; We're keeping this simple for now: a straightforward type switch.
|
||||||
(defn apply-clause [cc it]
|
(defn apply-clause [cc it]
|
||||||
(condp instance? it
|
(condp instance? it
|
||||||
|
@ -273,6 +297,9 @@
|
||||||
Pattern
|
Pattern
|
||||||
(apply-pattern-clause cc it)
|
(apply-pattern-clause cc it)
|
||||||
|
|
||||||
|
Function
|
||||||
|
(apply-function-clause cc it)
|
||||||
|
|
||||||
(raise "Unknown clause." {:clause it})))
|
(raise "Unknown clause." {:clause it})))
|
||||||
|
|
||||||
(defn expand-pattern-clauses
|
(defn expand-pattern-clauses
|
||||||
|
|
Loading…
Reference in a new issue