35 lines
1012 B
Clojure
35 lines
1012 B
Clojure
(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
|
|
:dbtype "postgresql"
|
|
:ssl true
|
|
:sslfactory "org.postgresql.ssl.NonValidatingFactory"
|
|
:host "ec2-54-235-123-153.compute-1.amazonaws.com"
|
|
:port 5342
|
|
:dbname "dbfemhppkdksfp"
|
|
; Any additional keys are passed to the driver
|
|
; as driver-specific properties.
|
|
:user "tkilrhrhzlumol"
|
|
:password "de6117f8551364ac84ed31c1231941f53ab0b5470c9956f478b2025ab5a0fb8b"})
|