Skip to content

Instantly share code, notes, and snippets.

@iomonad
Created April 13, 2017 06:58
Show Gist options
  • Save iomonad/f3842326c2ab2178a640e0e5aa394965 to your computer and use it in GitHub Desktop.
Save iomonad/f3842326c2ab2178a640e0e5aa394965 to your computer and use it in GitHub Desktop.
;; 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