Skip to content

Commit 84e5fdd

Browse files
macielticlaude
andcommitted
release 3.1.0: expose PostgreSQLPool schema
Adds `postgresql.component/PostgreSQLPool`, a Prismatic schema alias over `org.pg.Pool`, so consumers can validate pool references in their own schemas. Promotes `prismatic/schema` from :dev to main :dependencies and updates the integration test to validate the live pool against the new schema. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 6b8e2f9 commit 84e5fdd

4 files changed

Lines changed: 22 additions & 13 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33
All notable changes to this project will be documented in this file. This change log follows the conventions
44
of [keepachangelog.com](http://keepachangelog.com/).
55

6+
## 3.1.0 - 2026-04-19
7+
8+
### Added
9+
10+
- `postgresql.component/PostgreSQLPool` schema — Prismatic schema alias for `org.pg.Pool`, to validate pool references in consumer schemas.
11+
612
## 3.0.0 - 2026-02-08
713

814
### Changed

project.clj

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
(defproject net.clojars.macielti/postgresql "3.0.0"
1+
(defproject net.clojars.macielti/postgresql "3.1.0"
22

33
:description "PostgreSQL Component"
44

@@ -7,27 +7,27 @@
77
:license {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0"
88
:url "https://www.eclipse.org/legal/epl-2.0/"}
99

10-
:plugins [[com.github.clojure-lsp/lein-clojure-lsp "2.0.13"]
10+
:plugins [[com.github.clojure-lsp/lein-clojure-lsp "2.0.14"]
1111
[com.github.liquidz/antq "RELEASE"]
1212
[lein-shell "0.5.0"]]
1313

1414
:dependencies [[org.clojure/clojure "1.12.4"]
1515
[io.pedestal/pedestal.interceptor "0.8.1"]
16-
[com.github.igrishaev/pg2-core "0.1.41"]
17-
[com.github.igrishaev/pg2-migration "0.1.41"]
16+
[com.github.igrishaev/pg2-core "0.1.48"]
17+
[com.github.igrishaev/pg2-migration "0.1.48"]
1818
[org.clojure/tools.logging "1.3.1"]
19-
[integrant "1.0.1"]]
19+
[integrant "1.0.1"]
20+
[prismatic/schema "1.4.1"]]
2021

2122
:resource-paths ["resources"]
2223

2324
:profiles {:dev {:test-paths ["test/unit" "test/integration" "test/helpers"]
2425

2526
:resource-paths ["test/resources"]
2627

27-
:dependencies [[nubank/matcher-combinators "3.9.2"]
28+
:dependencies [[nubank/matcher-combinators "3.10.0"]
2829
[org.slf4j/slf4j-api "2.0.17"]
29-
[ch.qos.logback/logback-classic "1.5.23"]
30-
[prismatic/schema "1.4.1"]
30+
[ch.qos.logback/logback-classic "1.5.32"]
3131
[clojure.java-time "1.4.3"]
3232
[hashp "0.2.2"]]
3333

src/postgresql/component.clj

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
(ns postgresql.component
22
(:require [clojure.tools.logging :as log]
33
[integrant.core :as ig]
4-
[pg.core]))
4+
[pg.core])
5+
(:import (org.pg Pool)))
6+
7+
(def PostgreSQLPool Pool)
58

69
(defmethod ig/init-key ::postgresql
710
[_ {:keys [components]}]

test/integration/integration/postgresql_test.clj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,22 @@
55
[matcher-combinators.test :refer [match?]]
66
[pg.core :as pg]
77
[postgresql.component :as component.postgresql]
8-
[schema.test :as s])
9-
(:import (org.pg Pool)))
8+
[schema.core :as s]
9+
[schema.test :as schema.test]))
1010

1111
(def config {::component.postgresql/postgresql {:components {:config {:postgresql {:host "localhost"
1212
:port 5432
1313
:user "postgres"
1414
:password "root"
1515
:database "postgres-db"}}}}})
1616

17-
(s/deftest postgresql-integrant-component-test
17+
(schema.test/deftest postgresql-integrant-component-test
1818
(let [system (ig/init config)
1919
pool (::component.postgresql/postgresql system)
2020
now (jt/local-date)]
2121

2222
(testing "Should be able to init a system with PostgreSQL component"
23-
(is (match? {::component.postgresql/postgresql #(= (type %) Pool)}
23+
(is (match? {::component.postgresql/postgresql #(s/validate component.postgresql/PostgreSQLPool %)}
2424
system)))
2525

2626
(testing "Should be able to use the initiated PostgreSQL component to perform database operations"

0 commit comments

Comments
 (0)