Skip to content

Instantly share code, notes, and snippets.

@stingh711
Created February 25, 2014 13:58
Show Gist options
  • Save stingh711/9209245 to your computer and use it in GitHub Desktop.
Save stingh711/9209245 to your computer and use it in GitHub Desktop.
(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