Created
April 13, 2017 06:58
-
-
Save iomonad/f3842326c2ab2178a640e0e5aa394965 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
;; Connect to localhost with defaut port | |
;; Create an instance of the database | |
(def ^:dynamic *conn* (mg/connect{:host "127.0.0.1"})) | |
(def ^:dynamic *db* (mg/get-db *conn* "hives")) | |
(defn hive-insert-schema [hive temp weight humidity] | |
"Insert hive's post values in the database" | |
(let [date (.toString (java.util.Date.))] | |
(mc/insert *db* "hive" {:instance hive | |
:date date | |
:values{:temperature temp | |
:weight weight | |
:humidity humidity}}))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment