如何使用 Thrift 文件中使用关键字“include”定义的结构体
我是 Thrift 的新手。我有以下问题: 假设我在文件“Ex1.thrift”中定义了一个结构体,如下所示:
namespace java tut1
struct Address {
1:string nameStreet,
2:i32 idHouse
}
我想在文件“Ex2.thrift”中使用结构体地址,我该怎么做? 我尝试了这种方法,但 Thrift 编译器不起作用:
include "Ex1.thrift"
namespace java tut2
struct Student {
1:string name,
2:i32 age,
3:Address add
}
service ExampleService {
list<Student> getListStudent()
}
非常感谢您的回答。
I'm a newbie with Thrift. I have the following question:
Suppose that I defined a struct in file "Ex1.thrift" as follow:
namespace java tut1
struct Address {
1:string nameStreet,
2:i32 idHouse
}
I want to use struct Address in file "Ex2.thrift", how could I do that?
I tried this way but Thrift compiler doesn't work:
include "Ex1.thrift"
namespace java tut2
struct Student {
1:string name,
2:i32 age,
3:Address add
}
service ExampleService {
list<Student> getListStudent()
}
Thank you so much for any answer.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 Ex2.thrift 中使用地址时需要提供 Ex1 前缀
这适用于 Thrift 0.8.0
You need to provide Ex1 prefix while using address in Ex2.thrift
This works in Thrift 0.8.0