proto2

package
v0.0.0-...-3efa57d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 4, 2019 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const Default_Album_Mediocre bool = true
View Source
const Default_Album_Year string = "2015"
View Source
const Default_Song_Duration float64 = 3.3
View Source
const Default_Song_Good bool = true
View Source
const Default_Song_Name string = "Type in a Name"
View Source
const Default_Song_Track uint64 = 1

Variables

View Source
var DefaultHtmlStringer = func(req, resp interface{}) ([]byte, error) {
	header := []byte("<p><div class=\"container\"><pre>")
	data, err := encoding_json.MarshalIndent(resp, "", "\t")
	if err != nil {
		return nil, err
	}
	footer := []byte("</pre></div></p>")
	return append(append(header, data...), footer...), nil
}
View Source
var Footer string = `
	</body>
	</html>
	`
View Source
var FormProto2_Produce string = `` /* 22881-byte string literal not displayed */
View Source
var Genre_name = map[int32]string{
	0: "Pop",
	1: "Rock",
	2: "Jazz",
	3: "NintendoCore",
	4: "Indie",
	5: "Punk",
	6: "Dance",
}
View Source
var Genre_value = map[string]int32{
	"Pop":          0,
	"Rock":         1,
	"Jazz":         2,
	"NintendoCore": 3,
	"Indie":        4,
	"Punk":         5,
	"Dance":        6,
}
View Source
var Header func(servName, methodName string) string = func(servName, methodName string) string {
	return `
	<html>
	<head>
	<title>` + servName + `:` + methodName + `</title>
	<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
	<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
	<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
	</head>
	<body>
	`
}
View Source
var Instrument_name = map[int32]string{
	0: "Voice",
	1: "Guitar",
	2: "Drum",
}
View Source
var Instrument_value = map[string]int32{
	"Voice":  0,
	"Guitar": 1,
	"Drum":   2,
}

Functions

func NewHTMLProto2Server

func NewHTMLProto2Server(client Proto2Client, stringer func(req, resp interface{}) ([]byte, error)) *htmlProto2

func NewHandler

func NewHandler(grpcAddr string, stringer func(req, resp interface{}) ([]byte, error), opts ...google_golang_org_grpc.DialOption) (net_http.Handler, error)

func RegisterProto2Server

func RegisterProto2Server(s *grpc.Server, srv Proto2Server)

func Serve

func Serve(httpAddr, grpcAddr string, stringer func(req, resp interface{}) ([]byte, error), opts ...google_golang_org_grpc.DialOption)

Types

type Album

type Album struct {
	Name                 *string   `protobuf:"bytes,1,opt,name=Name" json:"Name,omitempty"`
	Song                 []*Song   `protobuf:"bytes,2,rep,name=Song" json:"Song,omitempty"`
	Genre                *Genre    `protobuf:"varint,3,opt,name=Genre,enum=proto2.Genre,def=1" json:"Genre,omitempty"`
	Year                 *string   `protobuf:"bytes,4,opt,name=Year,def=2015" json:"Year,omitempty"`
	Producer             []string  `protobuf:"bytes,5,rep,name=Producer" json:"Producer,omitempty"`
	Mediocre             *bool     `protobuf:"varint,6,opt,name=Mediocre,def=1" json:"Mediocre,omitempty"`
	Rated                *bool     `protobuf:"varint,7,opt,name=Rated" json:"Rated,omitempty"`
	Epilogue             *string   `protobuf:"bytes,8,opt,name=Epilogue" json:"Epilogue,omitempty"`
	Likes                []bool    `protobuf:"varint,9,rep,name=Likes" json:"Likes,omitempty"`
	Stars                *int64    `protobuf:"varint,10,opt,name=Stars" json:"Stars,omitempty"`
	Serial               []float64 `protobuf:"fixed64,11,rep,name=Serial" json:"Serial,omitempty"`
	XXX_NoUnkeyedLiteral struct{}  `json:"-"`
	XXX_unrecognized     []byte    `json:"-"`
	XXX_sizecache        int32     `json:"-"`
}

func (*Album) Descriptor

func (*Album) Descriptor() ([]byte, []int)

func (*Album) GetEpilogue

func (m *Album) GetEpilogue() string

func (*Album) GetGenre

func (m *Album) GetGenre() Genre

func (*Album) GetLikes

func (m *Album) GetLikes() []bool

func (*Album) GetMediocre

func (m *Album) GetMediocre() bool

func (*Album) GetName

func (m *Album) GetName() string

func (*Album) GetProducer

func (m *Album) GetProducer() []string

func (*Album) GetRated

func (m *Album) GetRated() bool

func (*Album) GetSerial

func (m *Album) GetSerial() []float64

func (*Album) GetSong

func (m *Album) GetSong() []*Song

func (*Album) GetStars

func (m *Album) GetStars() int64

func (*Album) GetYear

func (m *Album) GetYear() string

func (*Album) ProtoMessage

func (*Album) ProtoMessage()

func (*Album) Reset

func (m *Album) Reset()

func (*Album) String

func (m *Album) String() string

func (*Album) XXX_DiscardUnknown

func (m *Album) XXX_DiscardUnknown()

func (*Album) XXX_Marshal

func (m *Album) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Album) XXX_Merge

func (m *Album) XXX_Merge(src proto.Message)

func (*Album) XXX_Size

func (m *Album) XXX_Size() int

func (*Album) XXX_Unmarshal

func (m *Album) XXX_Unmarshal(b []byte) error

type Artist

type Artist struct {
	Name                 *string     `protobuf:"bytes,1,opt,name=Name" json:"Name,omitempty"`
	Role                 *Instrument `protobuf:"varint,2,opt,name=Role,enum=proto2.Instrument,def=1" json:"Role,omitempty"`
	XXX_NoUnkeyedLiteral struct{}    `json:"-"`
	XXX_unrecognized     []byte      `json:"-"`
	XXX_sizecache        int32       `json:"-"`
}

func (*Artist) Descriptor

func (*Artist) Descriptor() ([]byte, []int)

func (*Artist) GetName

func (m *Artist) GetName() string

func (*Artist) GetRole

func (m *Artist) GetRole() Instrument

func (*Artist) ProtoMessage

func (*Artist) ProtoMessage()

func (*Artist) Reset

func (m *Artist) Reset()

func (*Artist) String

func (m *Artist) String() string

func (*Artist) XXX_DiscardUnknown

func (m *Artist) XXX_DiscardUnknown()

func (*Artist) XXX_Marshal

func (m *Artist) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Artist) XXX_Merge

func (m *Artist) XXX_Merge(src proto.Message)

func (*Artist) XXX_Size

func (m *Artist) XXX_Size() int

func (*Artist) XXX_Unmarshal

func (m *Artist) XXX_Unmarshal(b []byte) error

type Genre

type Genre int32
const (
	Genre_Pop          Genre = 0
	Genre_Rock         Genre = 1
	Genre_Jazz         Genre = 2
	Genre_NintendoCore Genre = 3
	Genre_Indie        Genre = 4
	Genre_Punk         Genre = 5
	Genre_Dance        Genre = 6
)
const Default_Album_Genre Genre = Genre_Rock

func (Genre) Enum

func (x Genre) Enum() *Genre

func (Genre) EnumDescriptor

func (Genre) EnumDescriptor() ([]byte, []int)

func (Genre) String

func (x Genre) String() string

func (*Genre) UnmarshalJSON

func (x *Genre) UnmarshalJSON(data []byte) error

type Instrument

type Instrument int32
const (
	Instrument_Voice  Instrument = 0
	Instrument_Guitar Instrument = 1
	Instrument_Drum   Instrument = 2
)
const Default_Artist_Role Instrument = Instrument_Guitar

func (Instrument) Enum

func (x Instrument) Enum() *Instrument

func (Instrument) EnumDescriptor

func (Instrument) EnumDescriptor() ([]byte, []int)

func (Instrument) String

func (x Instrument) String() string

func (*Instrument) UnmarshalJSON

func (x *Instrument) UnmarshalJSON(data []byte) error

type Proto2Client

type Proto2Client interface {
	Produce(ctx context.Context, in *Album, opts ...grpc.CallOption) (*Album, error)
}

Proto2Client is the client API for Proto2 service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewProto2Client

func NewProto2Client(cc *grpc.ClientConn) Proto2Client

type Proto2Server

type Proto2Server interface {
	Produce(context.Context, *Album) (*Album, error)
}

Proto2Server is the server API for Proto2 service.

type Song

type Song struct {
	Name                 *string   `protobuf:"bytes,1,opt,name=Name,def=Type in a Name" json:"Name,omitempty"`
	Track                *uint64   `protobuf:"varint,2,opt,name=Track,def=1" json:"Track,omitempty"`
	Duration             *float64  `protobuf:"fixed64,3,opt,name=Duration,def=3.3" json:"Duration,omitempty"`
	Composer             []*Artist `protobuf:"bytes,4,rep,name=Composer" json:"Composer,omitempty"`
	Good                 *bool     `protobuf:"varint,5,opt,name=Good,def=1" json:"Good,omitempty"`
	XXX_NoUnkeyedLiteral struct{}  `json:"-"`
	XXX_unrecognized     []byte    `json:"-"`
	XXX_sizecache        int32     `json:"-"`
}

func (*Song) Descriptor

func (*Song) Descriptor() ([]byte, []int)

func (*Song) GetComposer

func (m *Song) GetComposer() []*Artist

func (*Song) GetDuration

func (m *Song) GetDuration() float64

func (*Song) GetGood

func (m *Song) GetGood() bool

func (*Song) GetName

func (m *Song) GetName() string

func (*Song) GetTrack

func (m *Song) GetTrack() uint64

func (*Song) ProtoMessage

func (*Song) ProtoMessage()

func (*Song) Reset

func (m *Song) Reset()

func (*Song) String

func (m *Song) String() string

func (*Song) XXX_DiscardUnknown

func (m *Song) XXX_DiscardUnknown()

func (*Song) XXX_Marshal

func (m *Song) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Song) XXX_Merge

func (m *Song) XXX_Merge(src proto.Message)

func (*Song) XXX_Size

func (m *Song) XXX_Size() int

func (*Song) XXX_Unmarshal

func (m *Song) XXX_Unmarshal(b []byte) error

type UnimplementedProto2Server

type UnimplementedProto2Server struct {
}

UnimplementedProto2Server can be embedded to have forward compatible implementations.

func (*UnimplementedProto2Server) Produce

func (*UnimplementedProto2Server) Produce(ctx context.Context, req *Album) (*Album, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL