Closed borkdude closed 3 years ago
Another interesting tidbit. We can make client-side wrappers that produce a tagged-value so we receive it in the pod and can do what we want with it.
;; clojure -Sdeps '{:deps {com.cognitect/transit-clj {:mvn/version "RELEASE"}}}' -M /tmp/array.clj
(require '[cognitect.transit :as transit])
(defn write-transit [v]
(let [baos (java.io.ByteArrayOutputStream.)]
(transit/write (transit/writer baos :json) v)
(.toString baos "utf-8")))
(defn read-transit [s]
(let [bais (java.io.ByteArrayInputStream. (.getBytes s "UTF-8"))]
(transit/read (transit/reader bais :json
{:handlers {"dude" (transit/read-handler (fn [rep]
{:dude rep}))}}))))
(def tagged-val (transit/tagged-value "dude" [1 2 3]))
(prn (read-transit (write-transit tagged-val)))
We can do this after we have given the transit handlers a proper test