threatgrid / asami

A graph store for Clojure and ClojureScript
Eclipse Public License 1.0
634 stars 29 forks source link

Add `:as` modifier to projections #192

Open quoll opened 3 years ago

quoll commented 3 years ago

Depends on #191 being complete.

Standard projected results are a seq of vectors, with the seq having metadata describing the column names for all of the vectors. These columns are named according the the variables that they are bound to, or for aggregate columns, a combination of the aggregate term and the variable it is evaluated on.

The :as keyword can be used after any element in the :find expression to rename the column.

Note: The :find expression may also contain constants. Check if these are correctly appearing in the cols array. For instance:

[:find ?x :data ?y :where ...]

Should return a seq with metadata of {:cols [?x :data ?y]}

Similarly:

[:find ?x :data :as ?z ?y :where ...]

Should return a seq with metadata of {:cols [?x ?z ?y]}