You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
but When I combine A with B . there is some tricky problem.
(let [message-b {:b10}
encoded (->> (protobuf/create B message-b)
(protobuf/->bytes)
(assoc {} :value)
(protobuf/create Any)
(assoc {} :any)
(protobuf/create A)
(protobuf/->bytes))
decoded (->> encoded
(protobuf/bytes-> (protobuf/create A))
:any
(protobuf/create A)
:value;; at this point. value's type is bytestring so It need to call `.toByteArray`
(.toByteArray) ; <<< a little tricky
(protobuf/bytes-> (protobuf/create B))
(into {}))]
(= message-b decoded))
So I need to fix encode/decode part like that.
(let [message-b {:b10}
encoded (->> (protobuf/create B message-b)
(protobuf/->bytes)
;; I inserted toByteArray on decoder. but it's type is `byte[]`
(com.google.protobuf.ByteString/copyFrom) ;; So It need to convert to bytestring.
(assoc {} :value)
(protobuf/create Any))
decoded (->> encoded
:value
(.toByteArray) ;; so I inserted.
(protobuf/bytes-> (protobuf/create B))
(into {}))]
(= message-b decoded))
It's works.
but com.google.protobuf.ByteString/copyFrom on this code likes tricky skill.
Is any other good suggestion of this? or Is anything what i missed?
The text was updated successfully, but these errors were encountered:
I want to put some message to
Any
.but the problem occurs.
let me assume. we have that kind of message.
So I can writing small encode/decode part for
B
but When I combine
A
withB
. there is some tricky problem.So I need to fix encode/decode part like that.
It's works.
but
com.google.protobuf.ByteString/copyFrom
on this code likes tricky skill.Is any other good suggestion of this? or Is anything what i missed?
The text was updated successfully, but these errors were encountered: