Add the following to your project.clj
:
Then you have to install the adapter:
(ns core
(:require [hugsql.core :as hugsql]
[hugsql.adapter.postgres-async :as ps-adapter]))
(hugsql/def-db-fns "fns.sql")
(hugsql/set-adapter! (ps-adapter/hugsql-adapter-postgres-async))
The HugSQL documentation is the definitive guide. The difference is that this adapter returns core.async
channels with the result or an exception. This adapter uses postgres.async
, so naturally it only works with postgres.