thrift
BaseTypes
- bool
- byte
- i16
- i32
- i64
- double
- binary
* string
Containers
* 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()
}