Thrift Data Types

Source: Internet
Author: User

First, the basic data type:

1, BOOL: Boolean type value, only true and false.

2, Byte:8-bit signed integer.

3, i16:16-bit signed integer.

4, i32:32-bit signed integer.

5, i64:64-bit signed integer.

6, double:64 bit floating point number.

7. String: The type of strings encoded using UTF-8.

Second, special data types:

1, binary: A binary sequence that is not encoded, is actually a byte array.

Third, structural data:

1, custom types, such as the following code defines a person's type:

struct person{    1:i32 ID,//PersonId    2:string name,//name}

2. Enumeration type:

Enum operation{    add = 1,//Add    delete = 2,//delete    UPDATE = 3,//change    find = 4,//check}

Iv. collection type:

1, List<t>: list types, such as defining a list that stores string types:

struct Person {    1:list<string> address,//List of cities visited}

2, Set<t>: Collection type

3, Map<t1, T2>: Map type for key-value pairs

Reference: Https://git1-us-west.apache.org/repos/asf?p=thrift.git;a=blob;f=tutorial/tutorial.thrift;hb=HEAD

Thrift Data Types

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.