Quantcast
Channel: How do I apply a PostgreSQL function to a query using Clojure? - Stack Overflow
Viewing all articles
Browse latest Browse all 2

How do I apply a PostgreSQL function to a query using Clojure?

$
0
0
(ns training-clj.querys  (:require [honey.sql :as honey]            [next.jdbc.sql :as jdbc]))(defn get-by-username  [db username]  (let [query (honey/format {:select [:*]                             :from   [:user]                             :where  [:= :username username]]})]    (jdbc/query db query)))

I'm doing a query in the db (postgresql) per user and I have a return similar to this: ({:id 2 :username "random" :age 18 :telephone 3120-4587}) and given this code base that I defined, I want to apply the PostgreSQL LOWER() function to the :username key, what are the ways I can do this?


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>
<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596344.js" async> </script>