      first
      insert-or-update-var
      pprint)
-
-
-#_(mon/fetch-one :see-alsos :where {:name "fnil"})
 
 
 

(defn all-notes []
  (j/query mysql-db ["SELECT * FROM comments"]))

(defn lookup-user [user-id]
  (select-keys (first (j/query mysql-db ["SELECT * FROM users WHERE id=?" user-id])) [:email :login]))

(defn lookup-ns [nsid]
  {:ns (->> (j/query mysql-db ["SELECT * FROM namespaces WHERE id=?" nsid])

       (map (fn [{:keys [updated_at body user_id]}]
              (when user_id ; some example versions don't have a user associated
                (let [user (lookup-user user_id)]
                  {:created-at (.getTime updated_at)
                   :body body
                   :editor user}))))
       (filter identity)
       (sort-by :created-at)
       #_reverse))
