Skip to content

Commit

Permalink
Update the documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
niwinz committed Oct 22, 2015
1 parent 8fbfff7 commit cee369c
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions doc/content.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -312,26 +312,25 @@ user defined types to jooq/jdbc compatible types, and other for backwards conver
[source, clojure]
----
(require '[suricatta.proto :as proto]
'[suricatta.impl :as impl]
'[cheshire.core :as json])
(import 'org.postgresql.util.PGobject)
(extend-protocol proto/IParamType
clojure.lang.IPersistentMap
(-render [self ctx]
(if (impl/inline? ctx)
(if (proto/-render-inline? ctx)
(str "'" (json/encode self) "'::json")
"?::json"))
(-bind [self ctx]
(when-not (impl/inline? ctx)
(let [stmt (.statement ctx)
idx (.nextIndex ctx)
(when-not (proto/-render-inline? ctx)
(let [stmt (proto/-get-statement ctx)
idx (proto/-get-next-bindindex ctx)
obj (doto (PGobject.)
(.setType "json")
(.setValue (json/encode (.-data self))))]))))
(.setObject stmt idx obj))
(.setValue (json/encode (.-data self))))]
(.setObject stmt idx obj)))))
----

The `-render` function is responsible of generate the appropiate sql for this field.
Expand Down

0 comments on commit cee369c

Please sign in to comment.