我正在使用grpc golang在客户端和服务器应用程序之间进行通信.下面是protoc缓冲区的代码.
syntax = "proto3";
package Trail;
service TrailFunc {
rpc HelloWorld (Request) returns (Reply) {}
}
// The request message containing the user's name.
message Request {
map<string,string> inputVar = 1;
}
// The response message containing the greetings
message Reply {
string outputVar = 1;
}
Run Code Online (Sandbox Code Playgroud)
我需要在消息数据结构中创建一个类型为map [string] interface {}的字段inputVar,而不是map [string] string.我怎样才能实现它?提前致谢.
我使用完成建议器自动完成..这些是我的文件
/* doc 1 */
{
Title: CineMAX: Inorbit Mall, Cyberabad
Suggest: {
input: [
CineMAX:
Inorbit
Mall
Cyberabad
CineMAX: Inorbit Mall, Cyberabad
]
output: CineMAX: Inorbit Mall, Cyberabad
payload: {
....
}
weight: 1
}
}
/* doc 2 */
{
Title: INOX: Kolkata
Suggest: {
input: [
INOX:
Kolkata
INOX: Kolkata
]
output: INOX: Kolkata
payload: {
....
}
weight: 1
}
}
Run Code Online (Sandbox Code Playgroud)
我使用完成查询如下
{
"suggestion":{
"text":"inox",
"completion":{
"field":"Suggest",
"fuzzy":{
"edit_distance":1,
"transpositions":true,
"prefix_length":1,
"min_length":4
}
}
}
} …Run Code Online (Sandbox Code Playgroud)