dynamic where clause

22 views
Skip to first unread message

Răzvan Rotaru

unread,
Mar 12, 2018, 1:55:38 PM3/12/18
to Korma
Hi,

How can I generate a dynamic where clause which contains the like operator? My initial approach was to just build the map and then pass it, but how can I specify operators like "like"?

(defn generate-where-clause[]
   ...
   {:name [like "%foo%"]}
)


(defn do-select[]
...
    (let [clause (generate-where-clause)]
        (select persons (where clause))))


Razvan

Alex Baranosky

unread,
Mar 12, 2018, 3:13:18 PM3/12/18
to Korma
(-> (select* persons)
      (where (generate-where-clause))
      exec)

--
You received this message because you are subscribed to the Google Groups "Korma" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sqlkorma+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages