Created
March 9, 2018 08:23
-
-
Save tlrobinson/6c8db4131b9ec4e536c1c32fc4b93d70 to your computer and use it in GitHub Desktop.
jooq in clojure
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(def conn (java.sql.DriverManager/getConnection "jdbc:postgresql://localhost:5432/db", "", nil)) | |
(def ctx (org.jooq.impl.DSL/using conn org.jooq.SQLDialect/POSTGRES)) | |
(defn parse-sql [query] (.parseQuery (.parser ctx) query)) | |
(defn select [body] (.select ctx body)) | |
(defn inline [value] (org.jooq.impl.DSL/inline value)) | |
(def a (select (inline 1))) | |
(def b (parse-sql "select 1")) | |
(log/info a) | |
(log/info b) | |
(log/info (= a b)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment