Permalink
Browse files

Added predicate for SQL BETWEEN operator.

  • Loading branch information...
1 parent e03ecd8 commit 773969f413ef8b5f8fe796b31cadfed5871c1a1e @pauldorman committed Feb 1, 2012
Showing with 5 additions and 2 deletions.
  1. +1 −1 project.clj
  2. +1 −1 src/korma/core.clj
  3. +1 −0 src/korma/sql/engine.clj
  4. +2 −0 src/korma/sql/fns.clj
View
@@ -1,4 +1,4 @@
-(defproject korma "0.3.0-beta2"
+(defproject org.clojars.pntblnk/korma "0.3.0-beta2"
:description "Tasty SQL for Clojure"
:dependencies [[org.clojure/clojure "[1.2.1],[1.3.0]"]
[c3p0/c3p0 "0.9.1.2"]
View
@@ -180,7 +180,7 @@
with keywords used to reference fields.
e.g. (where query (or (= :hits 1) (> :hits 5)))
- Available predicates: and, or, =, not=, <, >, <=, >=, in, like, not
+ Available predicates: and, or, =, not=, <, >, <=, >=, in, between, like, not
Where can also take a map at any point and will create a clause that compares keys
to values. The value can be a vector with one of the above predicate functions
@@ -161,6 +161,7 @@
'in 'korma.sql.fns/pred-in
'> 'korma.sql.fns/pred->
'< 'korma.sql.fns/pred-<
+ 'between 'korma.sql.fns/pred-between
'>= 'korma.sql.fns/pred->=
'<= 'korma.sql.fns/pred-<=
'not= 'korma.sql.fns/pred-not=
@@ -13,6 +13,8 @@
(defn pred-in [k v] (infix k "IN" v))
(defn pred-> [k v] (infix k ">" v))
(defn pred-< [k v] (infix k "<" v))
+(defn pred-between [k from to]
+ (infix k "BETWEEN" (group-with " AND " [from to])))
(defn pred->= [k v] (infix k ">=" v))
(defn pred-<= [k v] (infix k "<=" v))
(defn pred-like [k v] (infix k "LIKE" v))

0 comments on commit 773969f

Please sign in to comment.