簡體   English   中英

如何使用關鍵字“include”在Thrift文件中定義的結構

[英]How to use a struct defined in a Thrift file using keyword “include”

我是Thrift的新手。 我有以下問題:假設我在文件“Ex1.thrift”中定義了一個結構如下:

namespace java tut1
struct Address {
 1:string nameStreet,
 2:i32 idHouse
}

我想在文件“Ex2.thrift”中使用struct Address,我該怎么做? 我試過這種方式,但Thrift編譯器不起作用:

include "Ex1.thrift"
namespace java tut2
struct Student {
 1:string name,
 2:i32 age,
 3:Address add
}

service ExampleService {
 list<Student> getListStudent()
}

非常感謝你的回答。

在Ex2.thrift中使用地址時需要提供Ex1前綴

    include "Ex1.thrift"
    namespace java tut2
    struct Student {
    1:string name,
    2:i32 age,
    3:Ex1.Address add
    }

    service ExampleService {
    list<Student> getListStudent()
    }

這適用於Thrift 0.8.0

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

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