adding invoice db layer
This commit is contained in:
32
src/clj/auto_ap/db/utils.clj
Normal file
32
src/clj/auto_ap/db/utils.clj
Normal file
@@ -0,0 +1,32 @@
|
||||
(ns auto-ap.db.utils
|
||||
(:require [clojure.string :as str]))
|
||||
|
||||
(defn snake->kebab [s]
|
||||
(str/replace s #"_" "-"))
|
||||
|
||||
(defn kebab->snake [s]
|
||||
(str/replace s #"-" "_"))
|
||||
|
||||
(defn db->clj [x]
|
||||
(into {}
|
||||
(map
|
||||
(fn [[k v]]
|
||||
[(keyword (snake->kebab (name k))) v])
|
||||
x)))
|
||||
|
||||
(defn clj->db [x]
|
||||
(into {}
|
||||
(map
|
||||
(fn [[k v]]
|
||||
[(keyword (kebab->snake (name k))) v])
|
||||
x)))
|
||||
|
||||
(def conn {:classname "org.postgresql.Driver" ; must be in classpath
|
||||
:ssl true
|
||||
:sslfactory "org.postgresql.ssl.NonValidatingFactory"
|
||||
:subprotocol "postgresql"
|
||||
:subname (str "//ec2-54-235-123-153.compute-1.amazonaws.com:5342/dbfemhppkdksfp")
|
||||
; Any additional keys are passed to the driver
|
||||
; as driver-specific properties.
|
||||
:user "tkilrhrhzlumol"
|
||||
:password "de6117f8551364ac84ed31c1231941f53ab0b5470c9956f478b2025ab5a0fb8b"})
|
||||
Reference in New Issue
Block a user