Skip to content

Instantly share code, notes, and snippets.

@brycemcd
Created June 1, 2017 12:22
Show Gist options
  • Select an option

  • Save brycemcd/26dc4923acd4285b88f967c65cee38d7 to your computer and use it in GitHub Desktop.

Select an option

Save brycemcd/26dc4923acd4285b88f967c65cee38d7 to your computer and use it in GitHub Desktop.

Revisions

  1. brycemcd created this gist Jun 1, 2017.
    12 changes: 12 additions & 0 deletions db.clj
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    (ns learn-lein.core
    (:require [clojure.java.jdbc :as db]
    [jdbc.pool.c3p0 :as pool]))
    (def my-db {:subprotocol "postgresql"
    :subname "//spark3.thedevranch.net:5432/fitbit_heartrate"})

    (def my-pool (pool/make-datasource-spec my-db))

    (def heartrates (db/query my-pool ["SELECT * FROM activity_journal_minutes LIMIT 10"]))

    (doseq [item heartrates] (prn item))
    (doseq [item heartrates] (prn item :bpm))
    10 changes: 10 additions & 0 deletions project.clj
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    (defproject learn_lein "0.1.0-SNAPSHOT"
    :description "FIXME: write description"
    :url "http://example.com/FIXME"
    :license {:name "MIT"
    }
    :dependencies [[org.clojure/clojure "1.8.0"]
    [org.clojure/java.jdbc "0.7.0-alpha3"]
    [postgresql/postgresql "9.1-901-1.jdbc4"]
    [clojure.jdbc/clojure.jdbc-c3p0 "0.3.2"]]
    :main learn-lein.core )