From 410f9b23f8c090fd242487e441f185c57bedb47c Mon Sep 17 00:00:00 2001 From: Donald Clark Jackson Date: Sun, 14 Apr 2013 08:04:39 -0700 Subject: [PATCH 1/2] Extended java.util.HashMap with FHstorable --- project.clj | 7 ++++--- src/pghstore_clj/core.clj | 14 ++++++++++++-- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/project.clj b/project.clj index e970af4..84e297c 100644 --- a/project.clj +++ b/project.clj @@ -1,7 +1,8 @@ -(defproject pghstore-clj "0.1.0" +(defproject pghstore-clj "0.1.2" :description "Helper functions for working with PostgresSQL hstore data type in Clojure via JDBC" :url "http://github.com/blakesmith/pghstore-clj" :license {:name "Eclipse Public License" :url "http://www.eclipse.org/legal/epl-v10.html"} - :dependencies [[org.clojure/clojure "1.4.0"]] - :dev-dependencies [[postgresql "9.1-901.jdbc4"]]) \ No newline at end of file + :dependencies [[org.clojure/clojure "1.5.1"] + [prismatic/plumbing "0.0.1"]] + :dev-dependencies [[postgresql "9.2-1002.jdbc4"]]) diff --git a/src/pghstore_clj/core.clj b/src/pghstore_clj/core.clj index ad743a4..e090090 100644 --- a/src/pghstore_clj/core.clj +++ b/src/pghstore_clj/core.clj @@ -1,5 +1,6 @@ (ns pghstore-clj.core - (:require [clojure.string :as st]) + (:require [clojure.string :as st] + [plumbing.core :refer :all]) (:import [org.postgresql.util PGobject])) (defprotocol THstorable @@ -28,4 +29,13 @@ (map (fn [v] (map #(st/replace % #"\"" "") (st/split v #"=>"))) (st/split (.getValue this) #", "))] - [(keyword k) v]))))) \ No newline at end of file + [(keyword k) v]))))) + +(extend-type java.util.HashMap + FHstorable + (from-hstore + [this] + (->> this + (into {}) + keywordize-map))) + From 71cf9eebaa84896bf3225bfd37627158a565b399 Mon Sep 17 00:00:00 2001 From: Donald Clark Jackson Date: Sat, 22 Jun 2013 23:52:07 -0700 Subject: [PATCH 2/2] Can't remember :-( --- project.clj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project.clj b/project.clj index 84e297c..98b8fb8 100644 --- a/project.clj +++ b/project.clj @@ -1,4 +1,4 @@ -(defproject pghstore-clj "0.1.2" +(defproject net.likestream/pghstore-clj "0.1.2" :description "Helper functions for working with PostgresSQL hstore data type in Clojure via JDBC" :url "http://github.com/blakesmith/pghstore-clj" :license {:name "Eclipse Public License"