You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Jens Geyer (JIRA)" <ji...@apache.org> on 2015/06/03 00:49:50 UTC

[jira] [Closed] (THRIFT-3160) Make generated go enums implement TextMarshaller and TextUnmarshaller interfaces

     [ https://issues.apache.org/jira/browse/THRIFT-3160?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jens Geyer closed THRIFT-3160.
------------------------------

> Make generated go enums implement TextMarshaller and TextUnmarshaller interfaces
> --------------------------------------------------------------------------------
>
>                 Key: THRIFT-3160
>                 URL: https://issues.apache.org/jira/browse/THRIFT-3160
>             Project: Thrift
>          Issue Type: Improvement
>          Components: Go - Compiler
>    Affects Versions: 0.9.2
>            Reporter: Konstantin Shaposhnikov
>            Assignee: Konstantin Shaposhnikov
>             Fix For: 0.9.3
>
>
> This will make JSON encoder/decoders use string representation instead of meaningless numbers.
> The new generated code will looks like:
> {code}
> func (p TestEnum) MarshalText() ([]byte, error) {
> 	return []byte(p.String()), nil
> }
> func (p *TestEnum) UnmarshalText(text []byte) error {
> 	x, err := TestEnumFromString(string(text))
> 	*p = x
> 	return err
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)