   (:require [clojure.java.jdbc                  :as jdbc]
             [java-jdbc.sql                      :as sql-dsl]
             [task-tracker.server.service-config :refer [config]]))
-
-(def db (config :db))
 
 (defn gen-find-by-sql
   [^clojure.lang.Keyword table ^java.util.Map criteria]

(defn find-by
  [^clojure.lang.Keyword table ^java.util.Map criteria]
  (jdbc/query
   db
   [(gen-find-by-sql table criteria)]))

(defn insert-record
  [^clojure.lang.Keyword table ^java.util.Map params]
  (jdbc/insert!
   db
   table
   params))


  [^clojure.lang.Keyword table ^java.util.Map lookup-fields ^java.util.Map update-params]
  (let [where-clause (sql-dsl/where lookup-fields)]
    (jdbc/update!
     (config :db)
     table
     update-params
     where-clause)))
