You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@thrift.apache.org by Javier Garcia <ja...@gmail.com> on 2010/10/27 23:20:03 UTC

Doubt about map type

Hello,
I'm trying to make a .thrift file for a Python application in order to send
a Python dictionary as a method parameter.
I can define a map where the types of the key and value are fixed:
map <string key, string value> name

But I need a map where the value type is variable. The key is always a
string but the value might be a string, integer or another dictionary
Is it possible in thrift?

Thanks in advance

Re: Doubt about map type

Posted by Bryan Duxbury <br...@rapleaf.com>.
You can't do this directly, but you can make the value a struct or union
with one field of each type that you want to allow as a value. It's
cumbersome, particularly if you don't have unions fully implemented in your
library, but that's what we've got.

On Wed, Oct 27, 2010 at 2:20 PM, Javier Garcia <ja...@gmail.com> wrote:

> Hello,
> I'm trying to make a .thrift file for a Python application in order to send
> a Python dictionary as a method parameter.
> I can define a map where the types of the key and value are fixed:
> map <string key, string value> name
>
> But I need a map where the value type is variable. The key is always a
> string but the value might be a string, integer or another dictionary
> Is it possible in thrift?
>
> Thanks in advance
>