Created
August 3, 2014 05:51
-
-
Save swgillespie/7325058250c7190d5881 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 dbstuff.model | |
(:require [monger.core :as mg] | |
[monger.collection :as mc])) | |
(defn uuid [] | |
(str (java.util.UUID/randomUUID))) ;; CastClassException: clojure.lang.PersistentList cannot be cast to clojure.lang.Symbol | |
(deftype Database [conn table] | |
(create-user [username] | |
(mc/insert table "documents" { :_id (uuid) :username username }))) | |
(defn init-db [] | |
(let [conn (mg/connect) | |
table (mg/get-db "main")] | |
(Database. conn table))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment