8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fc3124f commit f159890Copy full SHA for f159890
src/postgres/async/impl.clj
@@ -1,14 +1,16 @@
1
(ns postgres.async.impl
2
(:require [clojure.string :as string]
3
- [clojure.core.async :refer [chan put! go]])
+ [clojure.core.async :refer [chan close! put! go]])
4
(:import [java.util.function Consumer]
5
[com.github.pgasync ResultSet]
6
[com.github.pgasync.impl PgRow]))
7
8
(defmacro defasync [name args]
9
`(defn ~name [~@args]
10
(let [c# (chan 1)]
11
- (~(symbol (subs (str name) 1)) ~@args #(put! c# (or %2 %1)))
+ (~(symbol (subs (str name) 1)) ~@args #(do
12
+ (put! c# (or %2 %1))
13
+ (close! c#)))
14
c#)))
15
16
(defmacro consumer-fn [[param] body]
0 commit comments