Skip to content

duct-framework/duct-hikaricp-component

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Duct-HikariCP-Component

Build Status

A component for the HikariCP JDBC connection pool, designed to be used in the Duct framework.

Installation

Add the following dependency to your project.clj:

[duct/hikaricp-component "0.1.2"]

Usage

Require the library, and the Component library:

(require '[duct.component.hikaricp :refer [hikaricp]]
         '[com.stuartsierra.component :as component])

Create a new HikariCP connection pool component with a JDBC database URI:

(def pool (hikaricp {:uri "jdbc:h2:mem:test"}))

Then start it to create the pool:

(alter-var-root #'pool component/start)

Starting the pool will create a :spec key that contains a map compatible with the Clojure java.jdbc library.

As with all components, the return value matters, and you are responsible for stopping the component when it's done. Ideally this component should be used within a larger system.

For more information, see the documentation for the Component library.

License

Copyright © 2018 James Reeves

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.

About

Clojure component for managing a HikariCP connection pool

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Clojure 100.0%