rename post-fn to row-fn
i think "row-fn" is a lot more clear as a name, especially since jdbc also uses the name row-fn to refer to the exact same thing
This commit is contained in:
parent
37e49d9730
commit
06edd82ff5
|
@ -8,12 +8,12 @@
|
|||
[clojure.java.jdbc :as j]
|
||||
[clojure.tools.logging :refer [warn]]))
|
||||
|
||||
(defrecord HSQLView [id db query-fn post-fn]
|
||||
(defrecord HSQLView [id db query-fn row-fn]
|
||||
IView
|
||||
(id [_] id)
|
||||
(data [_ namespace parameters]
|
||||
(let [start (System/currentTimeMillis)
|
||||
data (j/query db (hsql/format (apply query-fn parameters)) :row-fn post-fn)
|
||||
data (j/query db (hsql/format (apply query-fn parameters)) :row-fn row-fn)
|
||||
time (- (System/currentTimeMillis) start)]
|
||||
(when (>= time 1000) (warn id "took" time "msecs"))
|
||||
data))
|
||||
|
@ -25,5 +25,5 @@
|
|||
|
||||
(defn view
|
||||
"Creates a Honey SQL view that uses a jdbc database configuration"
|
||||
([id db hsql-fn post-fn] (HSQLView. id db hsql-fn post-fn))
|
||||
([id db hsql-fn] (view id db hsql-fn identity)))
|
||||
[id db hsql-fn & {:keys [row-fn]}]
|
||||
(HSQLView. id db hsql-fn (or row-fn identity)))
|
||||
|
|
Loading…
Reference in a new issue