Skip to content

Instantly share code, notes, and snippets.

@swlkr
Created November 4, 2017 17:19
Show Gist options
  • Save swlkr/537fa0df1355f9c75e6d9d8dcbc0075a to your computer and use it in GitHub Desktop.
Save swlkr/537fa0df1355f9c75e6d9d8dcbc0075a to your computer and use it in GitHub Desktop.
(ns your-project.models.items
(:require [oksql.core :as oksql])
(:refer-clojure :exclude [update]))
(def db {:connection-uri "postgres://localhost:5432/your_project_db"})
(defn create [m]
(oksql/insert db :items m))
(defn update [id m]
(oksql/update db :items m :items/where {:id id}))
(defn delete [id]
(oksql/delete db :items :items/where {:id id}))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment