您的位置:首页 > 其它

文章标题

2017-07-12 15:18 288 查看

thrift

BaseTypes

bool

byte

i16

i32

i64

double

binary

* string

Containers

list

set

* map

Namespace

namespace java com.example.project


Includes

include "tweet.thrift"
...
struct TweetSearchResult {
1: list<tweet.Tweet> tweets;
}


Constants

const i32 INT_CONST = 1234;
const map<string, string> MAP_CONST = {"hello":"world"}


Defining Structs

struct Location {
1:required double latitude;
2:required double longtitude;
}
struct Tweet {
1:required i32 userId;
2:required string username;
3:required string text;
4:optional Location location;
16:optional string language = "english";
}


Defining Service

Service Twitter {
void ping(),
bool postTweet(1:Tweet tweet) throws (1:TwitterUnavailable unavailable),
TweetSearchResult searchTweets(1:string query);
oneway void zip()
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: