Created
February 25, 2014 13:58
-
-
Save stingh711/9209245 to your computer and use it in GitHub Desktop.
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
(ns pdms.core | |
(:use korma.core | |
[korma.db :only (defdb)])) | |
(def db-spec {:subprotocol "postgresql" | |
:subname "//localhost/pdms" | |
:user "huleehom" | |
:password ""}) | |
(defdb db db-spec) | |
(defentity pdms_groups) | |
(defn create-pdms-group [group] | |
(insert pdms_groups | |
(values group))) | |
(defn add-all-groups [groups prefix] | |
(let [indexed-groups (map-indexed (fn [idx item] [(inc idx) item]) groups) | |
groups-with-path (map (fn [[idx m]] (assoc m :path (str prefix "." idx))) indexed-groups)] | |
(map create-pdms-group groups-with-path))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment