diff --git a/src/main/blog/db.cljs b/src/main/blog/db.cljs index c39a6a2..744ae20 100644 --- a/src/main/blog/db.cljs +++ b/src/main/blog/db.cljs @@ -27,7 +27,18 @@ (try (let [res (! channel (.-rows res))) - (catch js/Error err (js/console.log (ex-cause err)))) - ) + (catch js/Error err (js/console.log (ex-cause err))))) + channel) + +(defn get-article + "Reads an article with the id and returns via channel. It gets and returns the same channel. Empty collection if not found." + [client id channel] + (go + (try + (let [res (js [id])))] + (>! channel (.-rows res))) + (catch js/Error err (js/console.log (ex-cause err))))) channel)