Skip to content

Commit

Permalink
query: add show
Browse files Browse the repository at this point in the history
  • Loading branch information
pyr committed Sep 22, 2023
1 parent 802e251 commit a0750fe
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/seql/query.clj
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,19 @@
(->> (into-query schema params)
(sql/format)))

(defn show
"Return the SQL that would be ran for a particular EQL query against a schema.
Useful while building queries"
([env entity]
(show env entity (schema/resolve-fields (env/schema env) entity) []))
([env entity fields]
(show env entity fields []))
([env entity fields conditions]
(let [schema (env/schema env)]
(->> (params/for-query schema entity fields conditions)
(into-query schema)
(sql/format)))))

(defn educt
"Run a SEQL query and return an eduction of the records. No tree recomposition
is performed, joined rows will be returned one by one. Since SEQL's tree recomposition
Expand Down

0 comments on commit a0750fe

Please sign in to comment.