graphql used for invoices

This commit is contained in:
Bryce Covert
2018-04-12 10:17:15 -07:00
parent 4165c7d180
commit 7425f7f393
15 changed files with 266 additions and 115 deletions

View File

@@ -1,7 +1,9 @@
(ns auto-ap.db.utils
(ns auto-ap.db.utils
(:require [clojure.string :as str]
[clojure.edn :as edn]
[config.core :refer [env]]))
[clojure.java.jdbc :as j]
[config.core :refer [env]]
[honeysql.core :as sql]))
(defn snake->kebab [s]
(str/replace s #"_" "-"))
@@ -52,3 +54,13 @@
:user "ap"
:password "fifteen-invoices-imported!"}))
(defn query [q]
(let [formatted (sql/format q)]
(println "Executing query " q " SQL: " formatted)
(map db->clj (j/query (get-conn) formatted))))
(defn execute! [q]
(let [formatted (sql/format q)]
(println "Executing query " q " SQL: " formatted)
(j/execute! (get-conn) formatted)))