文章标题

来源:互联网 发布:网络拔草是什么意思啊 编辑:程序博客网 时间:2024/06/08 01:03

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()}
原创粉丝点击