Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

Merge branch 'master' into pagination

  • Loading branch information...
2 parents 221be32 + 26f2a64 commit 446a0ca2d07b340b4deda8a49bc9d5e3adc11737 @r0man r0man committed
Showing with 18 additions and 0 deletions.
  1. +18 −0 src/clojureql/core.clj
18 src/clojureql/core.clj
@@ -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 \"\"))
+ (where (= :email s))")
(project [this fields]
"Confines the query to the fieldlist supplied in fields
@@ -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))

0 comments on commit 446a0ca

Please sign in to comment.
Something went wrong with that request. Please try again.