-
Notifications
You must be signed in to change notification settings - Fork 38
Open
Labels
Description
Sometimes I want to add artificial fields to a query but can't
use project, because it overwrites previous selections. What
about adding something like:
(defn project+
[relation fields]
(assoc relation :tcols (concat (:tcols relation) fields)))
to ClojureQL? With this function I can add a "distance
calculation" to the query with something like this:
(-> spots-with-address
(select-in-bounding-box :spots.location bounding-box)
(project+ [[(str "distance(spots.location, ST_GeomFromText('" (make-point-2d 0 0) "'))") :as :distance]])
(sort [:distance]))
Thoughts? Suggestions?