thriftrw / thriftrw-node

A thrift binary encoding library using bufrw
MIT License
57 stars 25 forks source link

Struct literals #77

Open abhinav opened 9 years ago

abhinav commented 9 years ago

Apache Thrift supports struct literals in thrift files.

For example,

struct Date {
    1: byte day
    2: byte month
    3: i16 year
}

const Date foo = {'day': 1, 'month': 1, 'year': 1234}

The generated code includes,

ttypes.foo = new ttypes.Date({
'day' : 1,'month' : 1,'year' : 1234});
abhinav commented 9 years ago

Related uber/thriftrw-python#58