go - Create variable of type Map[string]interface{} in gRPC protoc buffer golang -


i'm using grpc golang communicate between client , server application. below code protoc buffer.

syntax = "proto3"; package trail;  service trailfunc {   rpc helloworld (request) returns (reply) {} }  // request message containing user's name. message request {   map<string,string> inputvar = 1; } // response message containing greetings message reply {   string outputvar = 1; } 

i need create field inputvar of type map[string]interface{} inside message data structure instead of map[string]string. how can achieve it? in advance.

proto3 has type any

import "google/protobuf/any.proto";  message errorstatus {   string message = 1;   repeated google.protobuf.any details = 2; } 

but if @ implementation, as

message {   string type_url = 1;   bytes value = 2; } 

you have define such message possibly using reflection , intermediate type.

see example application

https://github.com/golang/protobuf/issues/60


Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -