Skip to content

Instantly share code, notes, and snippets.

@swlkr
Created November 4, 2017 17:15
Show Gist options
  • Save swlkr/78afde158ab28aa18d5a6588b188ce96 to your computer and use it in GitHub Desktop.
Save swlkr/78afde158ab28aa18d5a6588b188ce96 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"})
(def query (partial oksql/query db))
(defn create [m]
(query :items/insert m))
(defn update [id m]
(query :items/update (merge {:id id} m)))
(defn delete [id]
(query :items/delete {:id id}))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment