yAsH
yAsH

Reputation: 3405

How to define list<any> in Thrift?

I want to write a Thrift function which outputs a list. But, there is no such datatype in Thrift. Also, the list datatype in Thrift takes only a single datatype. How do I solve this problem?

Upvotes: 3

Views: 354

Answers (2)

Jaafar AbuSair
Jaafar AbuSair

Reputation: 1

try something like this

union TAttributeValue {
  1: string stringValue,
  2: i32 intValue,
  3: double doubleValue,
  4: bool boolValue
}

struct TRequest {
  1: list<TAttributeValue> items
}

Upvotes: 0

Injun Song
Injun Song

Reputation: 101

Make container (struct) whose members are optional and have possible data types in thrift. Then, make list of that struct. It is not beautiful solution, but it works.

Upvotes: 0

Related Questions