Skip to content

Instantly share code, notes, and snippets.

@maxtaco
Last active August 31, 2016 02:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maxtaco/12f00778902c7af60e6c4e5b1cda4094 to your computer and use it in GitHub Desktop.
Save maxtaco/12f00778902c7af60e6c4e5b1cda4094 to your computer and use it in GitHub Desktop.
@namespace("foo.1")
protocol bar {
enum BoopType {
NONE_0,
BURN_1,
BILLY_2,
TILLY_3
}
variant burb switch (BoopType boop) {
case NONE:
int none;
case BURN:
string burn;
case BILLY:
boolean billy;
default:
array<int> defjam;
}
}
// Auto-generated by avdl-compiler v1.3.4 (https://github.com/keybase/node-avdl-compiler)
// Input file: x.avdl
package foo1
import (
rpc "github.com/keybase/go-framed-msgpack-rpc"
)
type BoopType int
const (
BoopType_NONE BoopType = 0
BoopType_BURN BoopType = 1
BoopType_BILLY BoopType = 2
BoopType_TILLY BoopType = 3
)
var BoopTypeMap = map[string]BoopType{
"NONE": 0,
"BURN": 1,
"BILLY": 2,
"TILLY": 3,
}
type Burb struct {
Boop__ BoopType `codec:"boop" json:"boop"`
None__ *int `codec:"none,omitempty" json:"none,omitempty"`
Burn__ *string `codec:"burn,omitempty" json:"burn,omitempty"`
Billy__ *bool `codec:"billy,omitempty" json:"billy,omitempty"`
Defjam__ *[]int `codec:"defjam,omitempty" json:"defjam,omitempty"`
}
func (o *Burb) Boop() BoopType {
return o.Boop__
}
func (o Burb) None() int {
if o.Boop__ != BoopType_NONE {
panic("wrong case accessed")
}
return *o.None__
}
func (o Burb) Burn() string {
if o.Boop__ != BoopType_BURN {
panic("wrong case accessed")
}
return *o.Burn__
}
func (o Burb) Billy() bool {
if o.Boop__ != BoopType_BILLY {
panic("wrong case accessed")
}
return *o.Billy__
}
func (o Burb) Defjam() []int {
if o.Boop__ == BoopType_NONE || o.Boop__ == BoopType_BURN || o.Boop__ == BoopType_BILLY {
panic("wrong case accessed")
}
return *o.Defjam__
}
func NewBurbWithNone(v int) Burb {
return Burb{
Boop__: BoopType_NONE,
None__: &v,
}
}
func NewBurbWithBurn(v string) Burb {
return Burb{
Boop__: BoopType_BURN,
Burn__: &v,
}
}
func NewBurbWithBilly(v bool) Burb {
return Burb{
Boop__: BoopType_BILLY,
Billy__: &v,
}
}
func NewBurbDefault(boop BoopType, v []int) Burb {
return Burb{
Boop__: boop,
Defjam__: &v,
}
}
type BarInterface interface {
}
func BarProtocol(i BarInterface) rpc.Protocol {
return rpc.Protocol{
Name: "foo.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