356 lines
11 KiB
Go
Raw Normal View History

2015-01-14 10:50:54 +00:00
// Code generated by protoc-gen-go.
// source: go-micro/examples/server/proto/example/example.proto
2015-01-13 23:31:27 +00:00
// DO NOT EDIT!
2015-05-05 19:05:06 +01:00
/*
2015-12-02 22:44:01 +00:00
Package go_micro_srv_example is a generated protocol buffer package.
2015-05-05 19:05:06 +01:00
It is generated from these files:
go-micro/examples/server/proto/example/example.proto
2015-05-05 19:05:06 +01:00
It has these top-level messages:
Message
2015-05-05 19:05:06 +01:00
Request
Response
StreamingRequest
StreamingResponse
Ping
Pong
2015-05-05 19:05:06 +01:00
*/
2015-12-02 22:44:01 +00:00
package go_micro_srv_example
2015-01-13 23:31:27 +00:00
2015-05-05 19:05:06 +01:00
import proto "github.com/golang/protobuf/proto"
2015-12-02 22:44:01 +00:00
import fmt "fmt"
import math "math"
import (
client "github.com/micro/go-micro/client"
server "github.com/micro/go-micro/server"
context "golang.org/x/net/context"
2015-12-02 22:44:01 +00:00
)
2015-01-13 23:31:27 +00:00
2015-05-05 19:05:06 +01:00
// Reference imports to suppress errors if they are not otherwise used.
2015-01-13 23:31:27 +00:00
var _ = proto.Marshal
2015-12-02 22:44:01 +00:00
var _ = fmt.Errorf
var _ = math.Inf
2015-01-13 23:31:27 +00:00
type Message struct {
Say string `protobuf:"bytes,1,opt,name=say" json:"say,omitempty"`
}
2015-12-02 22:44:01 +00:00
func (m *Message) Reset() { *m = Message{} }
func (m *Message) String() string { return proto.CompactTextString(m) }
func (*Message) ProtoMessage() {}
func (*Message) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
2015-01-13 23:31:27 +00:00
type Request struct {
2015-05-09 00:42:07 +01:00
Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
2015-01-13 23:31:27 +00:00
}
2015-12-02 22:44:01 +00:00
func (m *Request) Reset() { *m = Request{} }
func (m *Request) String() string { return proto.CompactTextString(m) }
func (*Request) ProtoMessage() {}
func (*Request) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
2015-01-13 23:31:27 +00:00
type Response struct {
2015-05-09 00:42:07 +01:00
Msg string `protobuf:"bytes,1,opt,name=msg" json:"msg,omitempty"`
2015-01-13 23:31:27 +00:00
}
2015-12-02 22:44:01 +00:00
func (m *Response) Reset() { *m = Response{} }
func (m *Response) String() string { return proto.CompactTextString(m) }
func (*Response) ProtoMessage() {}
func (*Response) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} }
2015-01-13 23:31:27 +00:00
type StreamingRequest struct {
Count int64 `protobuf:"varint,1,opt,name=count" json:"count,omitempty"`
}
2015-12-02 22:44:01 +00:00
func (m *StreamingRequest) Reset() { *m = StreamingRequest{} }
func (m *StreamingRequest) String() string { return proto.CompactTextString(m) }
func (*StreamingRequest) ProtoMessage() {}
func (*StreamingRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} }
type StreamingResponse struct {
Count int64 `protobuf:"varint,1,opt,name=count" json:"count,omitempty"`
}
2015-12-02 22:44:01 +00:00
func (m *StreamingResponse) Reset() { *m = StreamingResponse{} }
func (m *StreamingResponse) String() string { return proto.CompactTextString(m) }
func (*StreamingResponse) ProtoMessage() {}
func (*StreamingResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} }
type Ping struct {
Stroke int64 `protobuf:"varint,1,opt,name=stroke" json:"stroke,omitempty"`
}
func (m *Ping) Reset() { *m = Ping{} }
func (m *Ping) String() string { return proto.CompactTextString(m) }
func (*Ping) ProtoMessage() {}
func (*Ping) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} }
type Pong struct {
Stroke int64 `protobuf:"varint,1,opt,name=stroke" json:"stroke,omitempty"`
}
func (m *Pong) Reset() { *m = Pong{} }
func (m *Pong) String() string { return proto.CompactTextString(m) }
func (*Pong) ProtoMessage() {}
func (*Pong) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} }
2015-01-13 23:31:27 +00:00
func init() {
2015-12-02 22:44:01 +00:00
proto.RegisterType((*Message)(nil), "go.micro.srv.example.Message")
proto.RegisterType((*Request)(nil), "go.micro.srv.example.Request")
proto.RegisterType((*Response)(nil), "go.micro.srv.example.Response")
proto.RegisterType((*StreamingRequest)(nil), "go.micro.srv.example.StreamingRequest")
proto.RegisterType((*StreamingResponse)(nil), "go.micro.srv.example.StreamingResponse")
proto.RegisterType((*Ping)(nil), "go.micro.srv.example.Ping")
proto.RegisterType((*Pong)(nil), "go.micro.srv.example.Pong")
2015-12-02 22:44:01 +00:00
}
// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
var _ client.Option
var _ server.Option
// Client API for Example service
type ExampleClient interface {
2015-12-09 21:41:55 +00:00
Call(ctx context.Context, in *Request, opts ...client.CallOption) (*Response, error)
Stream(ctx context.Context, in *StreamingRequest, opts ...client.CallOption) (Example_StreamClient, error)
2015-12-18 21:51:51 +00:00
PingPong(ctx context.Context, opts ...client.CallOption) (Example_PingPongClient, error)
2015-12-02 22:44:01 +00:00
}
type exampleClient struct {
c client.Client
serviceName string
2015-12-02 22:44:01 +00:00
}
func NewExampleClient(serviceName string, c client.Client) ExampleClient {
2015-12-02 22:44:01 +00:00
if c == nil {
c = client.NewClient()
}
if len(serviceName) == 0 {
serviceName = "go.micro.srv.example"
}
2015-12-02 22:44:01 +00:00
return &exampleClient{
c: c,
serviceName: serviceName,
2015-12-02 22:44:01 +00:00
}
}
2015-12-09 21:41:55 +00:00
func (c *exampleClient) Call(ctx context.Context, in *Request, opts ...client.CallOption) (*Response, error) {
req := c.c.NewRequest(c.serviceName, "Example.Call", in)
2015-12-02 22:44:01 +00:00
out := new(Response)
2015-12-09 21:41:55 +00:00
err := c.c.Call(ctx, req, out, opts...)
2015-12-02 22:44:01 +00:00
if err != nil {
return nil, err
}
return out, nil
}
2015-12-09 21:41:55 +00:00
func (c *exampleClient) Stream(ctx context.Context, in *StreamingRequest, opts ...client.CallOption) (Example_StreamClient, error) {
2015-12-18 21:51:51 +00:00
req := c.c.NewRequest(c.serviceName, "Example.Stream", &StreamingRequest{})
2015-12-17 20:37:35 +00:00
stream, err := c.c.Stream(ctx, req, opts...)
2015-12-02 22:44:01 +00:00
if err != nil {
return nil, err
}
2015-12-18 21:51:51 +00:00
if err := stream.Send(in); err != nil {
return nil, err
}
2015-12-17 20:37:35 +00:00
return &exampleStreamClient{stream}, nil
2015-12-02 22:44:01 +00:00
}
type Example_StreamClient interface {
SendMsg(interface{}) error
RecvMsg(interface{}) error
Close() error
Recv() (*StreamingResponse, error)
2015-12-02 22:44:01 +00:00
}
type exampleStreamClient struct {
stream client.Streamer
2015-12-02 22:44:01 +00:00
}
func (x *exampleStreamClient) Close() error {
return x.stream.Close()
}
func (x *exampleStreamClient) SendMsg(m interface{}) error {
return x.stream.Send(m)
}
func (x *exampleStreamClient) RecvMsg(m interface{}) error {
return x.stream.Recv(m)
}
func (x *exampleStreamClient) Recv() (*StreamingResponse, error) {
2015-12-17 20:37:35 +00:00
m := new(StreamingResponse)
err := x.stream.Recv(m)
2015-12-17 20:37:35 +00:00
if err != nil {
return nil, err
2015-12-02 22:44:01 +00:00
}
2015-12-17 20:37:35 +00:00
return m, nil
2015-12-02 22:44:01 +00:00
}
2015-12-18 21:51:51 +00:00
func (c *exampleClient) PingPong(ctx context.Context, opts ...client.CallOption) (Example_PingPongClient, error) {
req := c.c.NewRequest(c.serviceName, "Example.PingPong", &Ping{})
stream, err := c.c.Stream(ctx, req, opts...)
if err != nil {
return nil, err
}
return &examplePingPongClient{stream}, nil
}
type Example_PingPongClient interface {
SendMsg(interface{}) error
RecvMsg(interface{}) error
Close() error
Send(*Ping) error
Recv() (*Pong, error)
}
type examplePingPongClient struct {
stream client.Streamer
}
func (x *examplePingPongClient) Close() error {
return x.stream.Close()
}
func (x *examplePingPongClient) SendMsg(m interface{}) error {
return x.stream.Send(m)
}
func (x *examplePingPongClient) RecvMsg(m interface{}) error {
return x.stream.Recv(m)
}
func (x *examplePingPongClient) Send(m *Ping) error {
return x.stream.Send(m)
}
func (x *examplePingPongClient) Recv() (*Pong, error) {
m := new(Pong)
err := x.stream.Recv(m)
if err != nil {
return nil, err
}
return m, nil
}
2015-12-02 22:44:01 +00:00
// Server API for Example service
type ExampleHandler interface {
2015-12-02 23:05:52 +00:00
Call(context.Context, *Request, *Response) error
2015-12-18 21:51:51 +00:00
Stream(context.Context, *StreamingRequest, Example_StreamStream) error
PingPong(context.Context, Example_PingPongStream) error
2015-12-02 22:44:01 +00:00
}
func RegisterExampleHandler(s server.Server, hdlr ExampleHandler) {
2015-12-19 23:38:46 +00:00
s.Handle(s.NewHandler(&Example{hdlr}))
2015-12-18 21:51:51 +00:00
}
2015-12-19 23:38:46 +00:00
type Example struct {
2015-12-18 21:51:51 +00:00
ExampleHandler
}
2015-12-19 23:38:46 +00:00
func (h *Example) Call(ctx context.Context, in *Request, out *Response) error {
2015-12-18 21:51:51 +00:00
return h.ExampleHandler.Call(ctx, in, out)
}
2015-12-19 23:38:46 +00:00
func (h *Example) Stream(ctx context.Context, stream server.Streamer) error {
2015-12-18 21:51:51 +00:00
m := new(StreamingRequest)
if err := stream.Recv(m); err != nil {
return err
}
return h.ExampleHandler.Stream(ctx, m, &exampleStreamStream{stream})
}
type Example_StreamStream interface {
SendMsg(interface{}) error
RecvMsg(interface{}) error
Close() error
Send(*StreamingResponse) error
2015-12-18 21:51:51 +00:00
}
type exampleStreamStream struct {
stream server.Streamer
2015-12-18 21:51:51 +00:00
}
func (x *exampleStreamStream) Close() error {
return x.stream.Close()
}
func (x *exampleStreamStream) SendMsg(m interface{}) error {
return x.stream.Send(m)
}
func (x *exampleStreamStream) RecvMsg(m interface{}) error {
return x.stream.Recv(m)
}
func (x *exampleStreamStream) Send(m *StreamingResponse) error {
return x.stream.Send(m)
2015-12-18 21:51:51 +00:00
}
2015-12-19 23:38:46 +00:00
func (h *Example) PingPong(ctx context.Context, stream server.Streamer) error {
2015-12-18 21:51:51 +00:00
return h.ExampleHandler.PingPong(ctx, &examplePingPongStream{stream})
}
type Example_PingPongStream interface {
SendMsg(interface{}) error
RecvMsg(interface{}) error
Close() error
Send(*Pong) error
Recv() (*Ping, error)
2015-12-18 21:51:51 +00:00
}
type examplePingPongStream struct {
stream server.Streamer
}
func (x *examplePingPongStream) Close() error {
return x.stream.Close()
}
func (x *examplePingPongStream) SendMsg(m interface{}) error {
return x.stream.Send(m)
}
func (x *examplePingPongStream) RecvMsg(m interface{}) error {
return x.stream.Recv(m)
2015-12-18 21:51:51 +00:00
}
func (x *examplePingPongStream) Send(m *Pong) error {
return x.stream.Send(m)
2015-12-18 21:51:51 +00:00
}
func (x *examplePingPongStream) Recv() (*Ping, error) {
2015-12-18 21:51:51 +00:00
m := new(Ping)
if err := x.stream.Recv(m); err != nil {
2015-12-18 21:51:51 +00:00
return nil, err
}
return m, nil
2015-12-02 22:44:01 +00:00
}
var fileDescriptor0 = []byte{
// 270 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x84, 0x91, 0x5f, 0x4b, 0xc3, 0x30,
0x14, 0xc5, 0x17, 0x56, 0xdb, 0x79, 0xfd, 0x83, 0x06, 0x99, 0x52, 0x50, 0x34, 0x0f, 0xba, 0x17,
0xd3, 0xa1, 0x7e, 0x03, 0x11, 0x7d, 0x11, 0x64, 0x3e, 0xfb, 0x10, 0xc7, 0x25, 0x0c, 0x9b, 0xa6,
0xe6, 0x66, 0x43, 0x3f, 0xbb, 0x2f, 0x6e, 0x69, 0x3b, 0xc6, 0xec, 0xf0, 0x29, 0x70, 0x7e, 0xe7,
0x5c, 0xce, 0x21, 0x70, 0xa7, 0xed, 0xb5, 0x99, 0x8c, 0x9d, 0xcd, 0xf0, 0x4b, 0x99, 0x32, 0x47,
0xca, 0x08, 0xdd, 0x0c, 0x5d, 0x56, 0x3a, 0xeb, 0x97, 0x6a, 0xf3, 0xca, 0xa0, 0xf2, 0x23, 0x6d,
0x65, 0x48, 0x49, 0x72, 0x33, 0x59, 0x33, 0xd1, 0x87, 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