Skip to content

Instantly share code, notes, and snippets.

Created June 10, 2014 17:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/f9a12fb49bd8585c4738 to your computer and use it in GitHub Desktop.
Save anonymous/f9a12fb49bd8585c4738 to your computer and use it in GitHub Desktop.
(ns test.db.core
(:use korma.core
[korma.db :only (defdb)])
(:require [test.db.schema :as schema]))
(comment
(ns test.db.schema)
(def db-spec
{:subprotocol "mysql"
:subname "//localhost:3306/test"
:user "root"
:password "*******"})
)
(defdb db schema/db-spec)
(defentity users)
(defn create-user [user]
(insert users
(values user)))
(defn update-user [id first-name last-name email]
(update users
(set-fields {:first_name first-name
:last_name last-name
:email email})
(where {:id id})))
(defn get-user [id]
(first (select users
(where {:id id})
(limit 1))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment