Created
August 31, 2016 18:02
-
-
Save maxtaco/0175164f6a360fdf832d9288cf86e025 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@namespace("shit.1") | |
protocol bar { | |
enum Types { | |
NONE_0, | |
BOZO_1, | |
BIPPY_2, | |
AGGLE_3, | |
FLAGGLE_4 | |
} | |
variant Boozle switch (Types typ) { | |
case BOZO: int; | |
case BIPPY: string; | |
case AGGLE: array<int>; | |
case FLAGGLE: array<boolean>; | |
default: int; | |
} | |
variant Noozle switch (int version) { | |
case 1: string; | |
case 2: int; | |
default: void; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Auto-generated by avdl-compiler v1.3.4 (https://github.com/keybase/node-avdl-compiler) | |
// Input file: x.avdl | |
package shit1 | |
import ( | |
rpc "github.com/keybase/go-framed-msgpack-rpc" | |
) | |
type Types int | |
const ( | |
Types_NONE Types = 0 | |
Types_BOZO Types = 1 | |
Types_BIPPY Types = 2 | |
Types_AGGLE Types = 3 | |
Types_FLAGGLE Types = 4 | |
) | |
var TypesMap = map[string]Types{ | |
"NONE": 0, | |
"BOZO": 1, | |
"BIPPY": 2, | |
"AGGLE": 3, | |
"FLAGGLE": 4, | |
} | |
type Boozle struct { | |
Typ__ Types `codec:"typ" json:"typ"` | |
Bozo__ *int `codec:"Bozo,omitempty" json:"Bozo,omitempty"` | |
Bippy__ *string `codec:"Bippy,omitempty" json:"Bippy,omitempty"` | |
Aggle__ *[]int `codec:"Aggle,omitempty" json:"Aggle,omitempty"` | |
Flaggle__ *[]bool `codec:"Flaggle,omitempty" json:"Flaggle,omitempty"` | |
Default__ *int `codec:"Default,omitempty" json:"Default,omitempty"` | |
} | |
func (o *Boozle) Typ() Types { | |
return o.Typ__ | |
} | |
func (o Boozle) Bozo() int { | |
if o.Typ__ != Types_BOZO { | |
panic("wrong case accessed") | |
} | |
return *o.Bozo__ | |
} | |
func (o Boozle) Bippy() string { | |
if o.Typ__ != Types_BIPPY { | |
panic("wrong case accessed") | |
} | |
return *o.Bippy__ | |
} | |
func (o Boozle) Aggle() []int { | |
if o.Typ__ != Types_AGGLE { | |
panic("wrong case accessed") | |
} | |
return *o.Aggle__ | |
} | |
func (o Boozle) Flaggle() []bool { | |
if o.Typ__ != Types_FLAGGLE { | |
panic("wrong case accessed") | |
} | |
return *o.Flaggle__ | |
} | |
func (o Boozle) Default() int { | |
if o.Typ__ == Types_BOZO || o.Typ__ == Types_BIPPY || o.Typ__ == Types_AGGLE || o.Typ__ == Types_FLAGGLE { | |
panic("wrong case accessed") | |
} | |
return *o.Default__ | |
} | |
func NewBoozleWithBozo(v int) Boozle { | |
return Boozle{ | |
Typ__: Types_BOZO, | |
Bozo__: &v, | |
} | |
} | |
func NewBoozleWithBippy(v string) Boozle { | |
return Boozle{ | |
Typ__: Types_BIPPY, | |
Bippy__: &v, | |
} | |
} | |
func NewBoozleWithAggle(v []int) Boozle { | |
return Boozle{ | |
Typ__: Types_AGGLE, | |
Aggle__: &v, | |
} | |
} | |
func NewBoozleWithFlaggle(v []bool) Boozle { | |
return Boozle{ | |
Typ__: Types_FLAGGLE, | |
Flaggle__: &v, | |
} | |
} | |
func NewBoozleDefault(typ Types, v int) Boozle { | |
return Boozle{ | |
Typ__: typ, | |
Default__: &v, | |
} | |
} | |
type Noozle struct { | |
Version__ int `codec:"version" json:"version"` | |
Int1__ *string `codec:"Int1,omitempty" json:"Int1,omitempty"` | |
Int2__ *int `codec:"Int2,omitempty" json:"Int2,omitempty"` | |
} | |
func (o *Noozle) Version() int { | |
return o.Version__ | |
} | |
func (o Noozle) Int1() string { | |
if o.Version__ != 1 { | |
panic("wrong case accessed") | |
} | |
return *o.Int1__ | |
} | |
func (o Noozle) Int2() int { | |
if o.Version__ != 2 { | |
panic("wrong case accessed") | |
} | |
return *o.Int2__ | |
} | |
func NewNoozleWith1(v string) Noozle { | |
return Noozle{ | |
Version__: 1, | |
Int1__: &v, | |
} | |
} | |
func NewNoozleWith2(v int) Noozle { | |
return Noozle{ | |
Version__: 2, | |
Int2__: &v, | |
} | |
} | |
func NewNoozleDefault(version int) Noozle { | |
return Noozle{ | |
Version__: version, | |
} | |
} | |
type BarInterface interface { | |
} | |
func BarProtocol(i BarInterface) rpc.Protocol { | |
return rpc.Protocol{ | |
Name: "shit.1.bar", | |
Methods: map[string]rpc.ServeHandlerDescription{}, | |
} | |
} | |
type BarClient struct { | |
Cli rpc.GenericClient | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment