【问题标题】:Thrift IDL syntax error - accept and return mapThrift IDL 语法错误 - 接受并返回映射
【发布时间】:2018-12-06 23:25:53
【问题描述】:

我正在编写一个节俭的服务器。其中一个函数应该接受map 并返回map

以下是我的旧文件:

service base{
    map<string, string>    method_1(1: map<string, double>)
}

service child extends base{
    map<string, string>    method_1(1: map<string, double>),
    void                    method_2(1:string path)
}

上面写着

ERROR: someservice.thrift:4] (last token was ')')
syntax error

我不知道语法有什么问题。

【问题讨论】:

  • 不知道这种语法有什么问题,我对这两个地图都进行了 typedef,它可以工作。我仍然有兴趣知道这有什么问题

标签: dictionary thrift idl


【解决方案1】:

你必须为你的论点命名

service base{
  map<string, string>    method_1(1: map<string, double> arg1)
}

service child extends base{
  map<string, string>    method_1(1: map<string, double> arg1),
  void                    method_2(1:string path)
}

你已经在method_2 正确地做,其参数是(1:string path),但是你在method_1(1: map&lt;string, double&gt;) 忘记了 - 这还不够。

顺便说一句,它与地图完全无关。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-11-24
    • 1970-01-01
    • 2020-05-16
    • 2014-11-20
    • 2016-08-12
    • 2012-10-01
    • 1970-01-01
    相关资源
    最近更新 更多