cost 138 ms
Protobuf消息沒有實現protoreflect.ProtoMessage(ProtoReflect方法有指針接收者)

[英]Protobuf message does not implement protoreflect.ProtoMessage (ProtoReflect method has pointer receiver)

我有一條導入"google/protobuf/any.proto"的 Protobuf 消息: 我正在嘗試使用 anypb 在data字段中序列化另一個 protobuf: 編譯后出現以下錯誤: 根據文檔,我在這里沒有做任何不尋常的事情。 我該如何解決這個問題? 這是我試圖序列化並存儲在data字 ...

Protobuf.Any - 從 json.RawMessage 解組

[英]Protobuf.Any - Unmarshal from a json.RawMessage

我有來自json.RawMessage格式的數據庫的數據。 具體的列是jsonb。 我真的找不到一種方法將數據解組到 proto 上定義為 protobuf.Any 的屬性,就像這樣。repeated google.protobuf.Any list = 1; 當我嘗試使用json.Unmarsh ...

未命名數組 - protobuf

[英]Unamed Array - protobuf

我想使用 protobuf 接收消息列表(數組)。 這個想法是接收類似的東西:[ { "field1": "value1", "field2": "value2" }, { "field1": "value1", "field2": "value2" ...

將 Go []interface{} 轉換為 protobuf 重復數組

[英]Converting Go []interface{} to protobuf Repeated Array

我有一個用 Go 編寫的服務,它從 rest api 獲取數據並將該數據作為 grpc 服務器返回。 我得到了一組 object。 我想通過 grpc protobuf 文件返回它。 但由於類型問題,它一直失敗,因為來自 api 的數據是 []interface{},我不知道如何通過 protobu ...

如何將 protbuf 數據解組到 Golang 中的自定義結構中

[英]How to unmarshal protbuf data into custom struct in Golang

我有一個代理服務,可以將 protobuf 翻譯成另一個結構。 我可以編寫一些手動代碼來做到這一點,但那是低效的和樣板的。 我還可以將 protobuf 數據轉換為 JSON,並將 JSON 數據反序列化到目標結構中,但是速度很慢而且 CPU 很重。 現在不推薦使用Unmarshaler接口,並且M ...

解組時 Protobuf oneof 類型始終為零

[英]Protobuf oneof type always nil when Unmarshalling

我定義了一個基本的 protobuf 消息: 我正在使用 kafka 創建一個事件驅動的系統,所以當這個事件被 kafka 消費者拾取時,我會解組消息,但placed_by字段始終為零。 我將它設置在這樣的服務中: 此時,事件 ( out ) 被廣播並由解組它的消費者拾取: 出於某種原因, orde ...

Protobuffers 和 Golang —— 寫出編組的結構並讀回

[英]Protobuffers and Golang --- writing out marshal'ed structs and reading back in

是否有一種普遍接受的“正確”方式從文件中寫出和讀回編組的協議緩沖區消息? 我一直在研究一個較小的項目,該項目使用 gRPC 在本地模擬完整網絡,並嘗試添加對文件的寫入/讀取,我可以保存狀態並在再次啟動時從那里開始。 似乎我天真地假設這些將保留在一行中: 從我寫的調試消息中; 但, 所以,我 ...

服務編譯成功,但未生成消息結構 - gRPC/Go

[英]Service compiling successfully, but message structs not generating - gRPC/Go

我使用 gRPC/protobufs 作為我的客戶端和服務器之間通信的協議,它們都寫在 go 中。我能夠運行下面的命令來生成cards.pb.go (服務器)和cards_grpc.pb.go (客戶端)文件沒有任何問題。 服務器文件運行良好,沒有任何問題。 但是,客戶端文件似乎無法訪問我在car ...

當 *string 值為 nil 時,如何將 *string 類型的值轉換/分配為 *wrapperspb.StringValue 類型?

[英]How to convert/assign a value with type *string to type *wrapperspb.StringValue when the *string value is nil?

我正在嘗試將類型為*string的值分配給類型為*wrapperspb.StringValue的變量。 然而,當*string為 nil 時,它會觸發一個錯誤(請查看代碼片段中的注釋以了解是何種錯誤)。 這是我的代碼的簡化版本: 有誰知道如何正確處理轉換/分配? 這是一個 golang 游樂場: ...

錯誤模塊 github.com/golang/protobuf 已棄用

[英]Error module github.com/golang/protobuf is deprecated

我的命令行go get或go get. 在我的 Golang 項目中。 錯誤是 我已嘗試在本網站逐步安裝 package protobuf 在此處輸入鏈接描述但我無法解決我的問題。 ...

將 protobuf 對象哈希為字符串作為 redis 數據庫的鍵

[英]Hash protobuf object to a string as the key for redis database

我有某種復雜的 protobuf 對象。 這是發送到我的 GRPC 端點的請求。 如果我以前沒有,我只想處理它。 所以我想將對象散列到某個字符串並將其存儲在我的 Redis 數據庫中。 我使用了 ObjectHash-Proto ,但使用新版本的 protobuf-compiler 我得到了這個錯誤 ...

Go build 命令拋出 - panic: interface conversion: interface {} is []uint8, not *validator.FieldValidator

[英]Go build command throws - panic: interface conversion: interface {} is []uint8, not *validator.FieldValidator

在下面的 Go 函數中,當我嘗試運行 build 命令來生成 pb.go 文件時出現錯誤。 恐慌:接口轉換:接口{}是[]uint8,不是*validator.FieldValidator github.com/mygithub/myproject/plugin.getFieldValidatorI ...


 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM