hey guys
I'm using datastore interop and I want to store an array
No matching method set found taking 2 args for class
com.google.cloud.datastore.Entity$Builder
this is the error for:
(create "aaaa" {:a [1 2 3]})
using:
(defn create
"Takes a map of keyword-value pairs and puts a new Entity in the Datastore.
The map must include a :kind String.b
Returns the saved Entity converted with entity-to-map (which will include the assigned :key)."
[kind item]
(let [kind-key (-> kind clojure.string/lower-case (str "-id") keyword)
key-built (.build (Key/newBuilder ^Key (.newKey (keyFac kind) (epoch-now))))
id (.getId key-built)
kind-id (.getId (.allocateId dataStore (.newKey (keyFac kind))))
properties (dissoc item kind-key)
new-properties (merge properties {kind-key kind-id})
entity (Entity/newBuilder ^Key key-built)
transaction (.newTransaction dataStore)]
(doseq [[prop-name value] new-properties]
;; doing cond for type hinting to .set for datastore
(log/info prop-name)
(log/info value)
(prn value)
(cond (nil? value) nil
(= java.util.Date (class value))
(.set ^Entity entity (name prop-name) ^Date value)
(coll? value) (.set ^Entity entity (name prop-name) (into-array value))
:else (do (.set ^Entity entity (name prop-name) value))))
(.put transaction (.build entity))
(.commit transaction)))
`if someone could help me, please
I saw that in javadoc of com.google.cloud.Datastore.Entity$Builder I can do this: