Port the models from YeSQL to Korma
The following pages are what our hipstr.models.connection
, hipstr.models.artist-model
, and hipstr.models.album-model
will be when ported from YeSQL to Korma. Note that the interfaces for each ported function are kept the same as YeSQL's generated functions, meaning that the ported functions will accept maps instead of explicit literals. If we were to design the model layer with Korma first and foremost in mind, our interfaces would have been simpler. The goal of this port is to illustrate how we can write the YeSQL-generated functions using Korma, and still have it work without having to modify the rest of the application.
Porting hisptr.models.connection
Porting the connection is done by simply adding a call to the korma.db/defdb
macro:
(ns hipstr.models.connection (:require [environ.core :refer [env]]) (:use korma.db)) (def db-spec {:classname (env :db-classname) :subprotocol (env :db-subprotocol) :subname (env...