(with-preds query pred-map)
(with-preds query pred-map {:keys [prefix]})
=> (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"
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close