From d7daee97ba1f418fbd2362d2b25f818581d3397e Mon Sep 17 00:00:00 2001 From: Antti Laisi Date: Tue, 3 May 2016 20:24:53 +0300 Subject: [PATCH 01/10] Next is 0.8.0. --- project.clj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project.clj b/project.clj index 858bf78..474e0a2 100644 --- a/project.clj +++ b/project.clj @@ -1,4 +1,4 @@ -(defproject alaisi/postgres.async "0.7.0" +(defproject alaisi/postgres.async "0.8.0-SNAPSHOT" :description "Asynchronous PostgreSQL Clojure client" :url "http://github.com/alaisi/postgres.async" :license {:name "Eclipse Public License" From 7db941407f619db9ce8e5001aa2094db3a081d70 Mon Sep 17 00:00:00 2001 From: Antti Laisi Date: Tue, 3 May 2016 20:56:36 +0300 Subject: [PATCH 02/10] Add example of converting dates. --- README.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 17ce1e6..6119162 100644 --- a/README.md +++ b/README.md @@ -138,7 +138,14 @@ Support for custom types can be added by extending `IPgParameter` protocol and ` (.getBytes (str store) "UTF-8"))) (defmethod from-pg-value com.github.pgasync.impl.Oid/HSTORE [oid ^bytes value] - (my-h-store/parse-string (String. value "UTF-8))) + (my-h-store/parse-string (String. value "UTF-8"))) +``` + +`from-pg-value` can also be used for overriding "core" types. This is especially useful with temporal data types that are by default converted to `java.sql.Date`, `java.sql.Time`, `java.sql.Timestamp`. + +```clojure +(defmethod from-pg-value com.github.pgasync.impl.Oid/DATE [oid ^bytes value] + (java.time.LocalDate/parse (String. value "UTF-8"))) ``` ## Dependencies From cbb0c70e51fe3c429c13da3348647d31f792017f Mon Sep 17 00:00:00 2001 From: Antti Laisi Date: Tue, 3 May 2016 23:15:19 +0300 Subject: [PATCH 03/10] Fix reflection warning. --- src/postgres/async.clj | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/postgres/async.clj b/src/postgres/async.clj index 9ec8854..caa2c60 100644 --- a/src/postgres/async.clj +++ b/src/postgres/async.clj @@ -13,15 +13,15 @@ (defn- create-converter [] (proxy [DataConverter] [] + (fromConvertable [value] + (to-pg-value value)) (toObject [oid value] (when value - (let [val (from-pg-value oid value)] - (if (= ::raw-value val) - (proxy-call-with-super #(.toObject ^DataConverter this oid value) - this "toObject") - val)))) - (fromConvertable [value] - (to-pg-value value)))) + (let [val (from-pg-value oid value) + this ^DataConverter this] + (if-not (= ::raw-value val) + val + (proxy-super toObject oid value))))))) (defn open-db "Creates a db connection pool" From e857b45e6587509fdde89778ac7df79a64dff221 Mon Sep 17 00:00:00 2001 From: Antti Laisi Date: Wed, 4 May 2016 10:57:13 +0300 Subject: [PATCH 04/10] Add clojars badge. --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 6119162..c46b02e 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ postgres.async ============== +[![Clojars Project](https://img.shields.io/clojars/v/alaisi/postgres.async.svg)](https://clojars.org/alaisi/postgres.async) + Asynchronous PostgreSQL client for Clojure. ## Download From 5a623e443f9c9a92204d53f51d5ea70ce45ce0dc Mon Sep 17 00:00:00 2001 From: Antti Laisi Date: Fri, 10 Jun 2016 20:10:51 +0300 Subject: [PATCH 05/10] Upgrade to postgres-async-driver 0.9 and Netty 4.1 (Fixes #20). --- project.clj | 2 +- src/postgres/async/impl.clj | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/project.clj b/project.clj index 474e0a2..d0ee363 100644 --- a/project.clj +++ b/project.clj @@ -7,7 +7,7 @@ :url "http://github.com/alaisi/postgres.async.git"} :dependencies [[org.clojure/clojure "1.8.0"] [org.clojure/core.async "0.2.374"] - [com.github.alaisi.pgasync/postgres-async-driver "0.8"] + [com.github.alaisi.pgasync/postgres-async-driver "0.9"] [cheshire "5.6.1" :scope "provided"]] :lein-release {:deploy-via :clojars} :global-vars {*warn-on-reflection* true} diff --git a/src/postgres/async/impl.clj b/src/postgres/async/impl.clj index 435f55e..924b9bc 100644 --- a/src/postgres/async/impl.clj +++ b/src/postgres/async/impl.clj @@ -22,12 +22,8 @@ (vec (map column->value value)) value)) -;; TODO: make columns public in the Java driver (defn- get-columns [^PgRow row] - (-> (doto (.getDeclaredField PgRow "columns") - (.setAccessible true)) - (.get row) - (keys))) + (keys (.getColumns row))) (defn- row->map [^PgRow row ^Object rowmap ^String col] (assoc rowmap From 8a88fda9ba0a0c1c896eab8a86fbd1be0794556f Mon Sep 17 00:00:00 2001 From: Antti Laisi Date: Fri, 10 Jun 2016 20:14:56 +0300 Subject: [PATCH 06/10] lein-release plugin: preparing 0.8.0 release --- project.clj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project.clj b/project.clj index d0ee363..c4f7029 100644 --- a/project.clj +++ b/project.clj @@ -1,4 +1,4 @@ -(defproject alaisi/postgres.async "0.8.0-SNAPSHOT" +(defproject alaisi/postgres.async "0.8.0" :description "Asynchronous PostgreSQL Clojure client" :url "http://github.com/alaisi/postgres.async" :license {:name "Eclipse Public License" From e34d8df3a291971f2d53a01211d4ba67b1cb415e Mon Sep 17 00:00:00 2001 From: Antti Laisi Date: Fri, 10 Jun 2016 20:15:19 +0300 Subject: [PATCH 07/10] lein-release plugin: bumped version from 0.8.0 to 0.8.1-SNAPSHOT for next development cycle --- project.clj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project.clj b/project.clj index c4f7029..6b3344d 100644 --- a/project.clj +++ b/project.clj @@ -1,4 +1,4 @@ -(defproject alaisi/postgres.async "0.8.0" +(defproject alaisi/postgres.async "0.8.1-SNAPSHOT" :description "Asynchronous PostgreSQL Clojure client" :url "http://github.com/alaisi/postgres.async" :license {:name "Eclipse Public License" From 03f563305d749b918949fc0f0c6c52e0a16b1710 Mon Sep 17 00:00:00 2001 From: Antti Laisi Date: Fri, 10 Jun 2016 20:16:14 +0300 Subject: [PATCH 08/10] Next is 0.9.0 --- project.clj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project.clj b/project.clj index 6b3344d..f78cba8 100644 --- a/project.clj +++ b/project.clj @@ -1,4 +1,4 @@ -(defproject alaisi/postgres.async "0.8.1-SNAPSHOT" +(defproject alaisi/postgres.async "0.9.0-SNAPSHOT" :description "Asynchronous PostgreSQL Clojure client" :url "http://github.com/alaisi/postgres.async" :license {:name "Eclipse Public License" From faf26366fdc5804e2bbaf227c22d7b2a8b64c8a8 Mon Sep 17 00:00:00 2001 From: Antti Laisi Date: Fri, 10 Jun 2016 20:18:23 +0300 Subject: [PATCH 09/10] Touch readme to update clojars version. --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index c46b02e..1337097 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,6 @@ Add the following to your [Leiningen](http://github.com/technomancy/leiningen) ` ![latest postgres.async version](https://clojars.org/alaisi/postgres.async/latest-version.svg) - ## Setting up a connection pool A pool of connections to PostgreSQL backend is created with `open-db`. Each connection *pool* starts a single I/O thread used in communicating with PostgreSQL backend. From ff54a448f9dc20eaae76ece6ffc64af9adb63a5f Mon Sep 17 00:00:00 2001 From: Andrea Maria Piana Date: Fri, 9 Sep 2016 12:35:46 +0100 Subject: [PATCH 10/10] Add link to clojars in README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1337097..4c6b1bc 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ Asynchronous PostgreSQL client for Clojure. Add the following to your [Leiningen](http://github.com/technomancy/leiningen) `project.clj`: -![latest postgres.async version](https://clojars.org/alaisi/postgres.async/latest-version.svg) +[![latest postgres.async version](https://clojars.org/alaisi/postgres.async/latest-version.svg)](https://clojars.org/alaisi/postgres.async) ## Setting up a connection pool