Integrant methods for connecting to a SQL database from the Duct framework.
For pooled connections, use database.sql.hikaricp.
Add the following dependency to your deps.edn file:
org.duct-framework/database.sql {:mvn/version "0.3.0"}
Or to your Leiningen project file:
[org.duct-framework/database.sql "0.3.0"]
This library provides two things: a Boundary
record that holds a
DataSource, and an init-key
method for :duct.database/sql
that
creates that record.
The key takes the same argument map as the get-datasource
function
from next.jdbc.
{:duct.database/sql {:jdbcUrl "jdbc:sqlite:db/example.sqlite"}}
When you write functions against the database, consider using a
protocol and extending the Boundary
record. This will allow you to
easily mock or stub out the database using a tool like Shrubbery.
Copyright © 2024 James Reeves
Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.
Can you improve this documentation?Edit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close