Tooling of partials

For CRUD operations, I define the atomic CRUD in db.core, then each respective table namespace partials those operations. The result is nice modular code where things like job/READ do what they’re supposed to and respect any functionality upgrades made to the base method. The only problem is that the (def ... (partial ...)) structure doesn’t play nicely with tooling; because it isn’t a defn, it isn’t picked up as a function for autocompletion by cider, and it doesn’t get the same treatment as a function. Any solutions out there?

    ;; db/READ
    (defn READ
      "Get anything from table by id, or all without id"
      [table-keyword &[id select-field-keys]]
      (cond-> {:select (or select-field-keys [:*])
    	   :from [table-keyword]}
        id (assoc :where [:= :id id])
        1 sql/format
        1 dbr
        id first
        (= 1 (count select-field-keys)) (#((first select-field-keys) %))))
    ;; jobs/READ
    (def READ  (partial db/READ :jobs))


This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.