Liking cljdoc? Tell your friends :D

inquery.core


escape-paramsclj/s

(escape-params params mode)
source

make-query-mapclj/s

(make-query-map names)
(make-query-map names {:keys [path]})
source

read-queryclj/s

(read-query path qname)
source (clj)source (cljs)

seq->in-paramsclj/s

(seq->in-params xs)
source

seq->update-valsclj/s

(seq->update-vals xs)
source

treat-as?clj/s

(treat-as? k v)
source

with-paramsclj/s

(with-params query params)
(with-params query params {:keys [esc]})
source

with-predsclj/s

(with-preds query pred-map)
(with-preds query pred-map {:keys [prefix]})
  • adds predicates to the query
  • if "where" needs to be prefixed add {:prefix "where"}
  • will remove any SQL ops that a predicate starts with in case it needs to go right after "where"
  • if none preds matched with "where" prefix the prefix won't be used

=> (q/with-preds "select foo from bar where this = that" {#(= 42 42) "and dog = :bow" #(= 2 5) "and cat = :moo" #(= 28 28) "or cow = :moo"})

=> "select foo from bar where this = that and dog = :bow or cow = :moo"

;; or with "where":

=> (q/with-preds "select foo from bar" {#(= 42 42) "and dog = :bow" #(= 2 5) "and cat = :moo" #(= 28 28) "or cow = :moo"} {:prefix "where"})

=> "select foo from bar where dog = :bow or cow = :moo"

* adds predicates to the query
 * if "where" needs to be prefixed add {:prefix "where"}
 * will remove any SQL ops that a predicate starts with in case it needs to go right after "where"
 * if none preds matched with "where" prefix the prefix won't be used

=> (q/with-preds "select foo from bar where this = that"
                  {#(= 42 42) "and dog = :bow"
                   #(= 2 5) "and cat = :moo"
                   #(= 28 28) "or cow = :moo"})

=> "select foo from bar
     where this = that
     and dog = :bow
     or cow = :moo"

;; or with "where":

=> (q/with-preds "select foo from bar"
                  {#(= 42 42) "and dog = :bow"
                   #(= 2 5) "and cat = :moo"
                   #(= 28 28) "or cow = :moo"}
                   {:prefix "where"})

=> "select foo from bar
     where dog = :bow
           or cow = :moo"
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close