google-cloud

Google Cloud Platform: Clojure + {GAE, GCE, anything else on Google Platform}
2019-02-11T17:57:55.000200Z

guys

2019-02-11T17:58:05.000500Z

i'm coding some datastore interop

2019-02-11T17:58:26.001Z

I'm having some trouble with Entity/newBuilder

2019-02-11T17:59:48.001200Z

(let [kind "Channel"
      item {:channel-sid                 "CH52d777cf775a449988563cb42b92cc5d"
            :user-id                     25523386059076410
            :contact-user-id             39593488156767110
            :contact-name                "Ingrid"
            :contact-category            ""
            :contact-title               ""
            :contact-photo-path          ""
            :channel-type                "private"
            :channel-friendly-name       "avocado"
            :last-consumed-message-index 0
            :last-consumed-timestamp     #inst"2019-12-31"
            ;; :unread-messages-count       0
            ;; :created-by                  25523386059076410
            ;; :date-created                #inst"2019-12-31"
            ;; :channel-status              "joined"
            ;; :muted                       #inst"2019-12-31"
            :fav                         true
            :archived                    false}
      kind-key (-> kind clojure.string/lower-case (str "-id") keyword)
      key-built (.build (Key/newBuilder (.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-built)
      transaction (.newTransaction dataStore)]
  (doseq [[prop-name value] new-properties]
    (cond (inst? value) (.set ^Entity$Builder entity ^String (name prop-name) ^java.util.Date value)
          (string? value) (.set ^Entity$Builder entity ^String (name prop-name) ^String value)
          (number? value) (.set ^Entity$Builder entity ^String (name prop-name) ^Number value)
          (boolean? value) (.set ^Entity$Builder entity ^String (name prop-name) ^Boolean value)
          :else (throw (ex-info (str "There is no implementation to insert "
                                     (pr-str [prop-name value]) " because there are no implementations on this function for :"
                                     (pr-str (class value)))
                                {:prop-name prop-name :value value})))))

2019-02-11T18:00:23.001600Z

This are giving me: Syntax error (IllegalArgumentException) compiling at (datastore.clj:118:1). No matching method set found taking 2 args for class com.google.cloud.datastore.Entity$Builder

2019-02-11T18:01:59.002100Z

=/ Anyone could help me?