diff --git a/project.clj b/project.clj index e970af4..98b8fb8 100644 --- a/project.clj +++ b/project.clj @@ -1,7 +1,8 @@ -(defproject pghstore-clj "0.1.0" +(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" :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))) +