Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/clizzin/clojureql into sif
Browse files Browse the repository at this point in the history
  • Loading branch information
Lau B. Jensen committed Mar 24, 2011
2 parents 40dcb85 + 8e9d17e commit 26f2a64
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/clojureql/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,18 @@
"Confines the query to rows for which the predicate is true
Ex. (select (table :users) (where (= :id 5)))")

(select-if [this test predicate]
[this test predicate else]
"Evaluates test. If logical true, confines the query to rows for which
the predicate is true. Optionally accepts a predicate to confine the
query if the test is logical false.
Ex. (select-if (table :users)
(nil? s)
(where (= :email \"default@website.com\"))
(where (= :email s))")

(project [this fields]
"Confines the query to the fieldlist supplied in fields
Expand Down Expand Up @@ -219,6 +231,12 @@
(->> (qualify-predicate this clause)
(fuse-predicates (or restriction (predicate nil nil)))))))

(select-if [this test clause]
(if test (select this clause) this))

(select-if [this test clause else]
(if test (select this clause) (select this else)))

(project [this fields]
(assoc this :tcols fields))

Expand Down

0 comments on commit 26f2a64

Please sign in to comment.