This channel still work?
Yeah, but chances are nobody used duct with toucan.
What are you trying to implement?
For me it looks like you should create your component, which will connect / disconnect to database on init / halt
You should also note https://github.com/metabase/toucan/issues/42
Looks like toucan prefers to set global default connection and then all functions will use it.
So, one of the ways is like this
clojure
(ns foo.database.toucan
(:require [toucan.db :as db]))
(defmethod ig/init-key :foo.database/toucan [_ options]
; the options are
; {:classname "org.postgresql.Driver"
; :subprotocol "postgresql"
; :subname "//localhost:5432/my_db"
; :user "cam"}
(db/set-default-db-connection! options))
(defmethod ig/halt-key! :foo.database/toucan [_ {:keys [spec]}]
;; somehow close connection, probably should look into toucan / clojure.java.jdbc
)
Then use toucan as usual.
The problem with connection closing is that duct workflow includes reloading the system, and when the system reloads you should, probably, close old connections.
For connection pools it might be easier, because connection pool will be component by itself.
Looking at toucan code you might not need to close the connection.
But there’s other issue with toucan — the default db connection is an implicit dependency, and duct / integrant style prefers explicit dependencies.
Issue https://github.com/metabase/toucan/issues/42 contains a general description of explicit dependency usage.