2015-01-14 10:50:54 +00:00
|
|
|
// Code generated by protoc-gen-go.
|
2015-12-06 22:44:17 +00:00
|
|
|
// 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:
|
2015-12-06 22:44:17 +00:00
|
|
|
go-micro/examples/server/proto/example/example.proto
|
2015-05-05 19:05:06 +01:00
|
|
|
|
|
|
|
It has these top-level messages:
|
2015-06-12 19:52:27 +01:00
|
|
|
Message
|
2015-05-05 19:05:06 +01:00
|
|
|
Request
|
|
|
|
Response
|
2015-06-01 18:55:27 +01:00
|
|
|
StreamingRequest
|
|
|
|
StreamingResponse
|
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"
|
2015-12-07 16:12:59 +00:00
|
|
|
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
|
|
|
|
2015-06-12 19:52:27 +01: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-06-12 19:52:27 +01:00
|
|
|
|
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
|
|
|
|
2015-06-01 18:55:27 +01: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} }
|
2015-06-01 18:55:27 +01:00
|
|
|
|
|
|
|
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} }
|
2015-06-01 18:55:27 +01:00
|
|
|
|
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")
|
|
|
|
}
|
|
|
|
|
|
|
|
// 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-02 22:44:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type exampleClient struct {
|
2015-12-06 22:44:17 +00:00
|
|
|
c client.Client
|
|
|
|
serviceName string
|
2015-12-02 22:44:01 +00:00
|
|
|
}
|
|
|
|
|
2015-12-06 22:44:17 +00:00
|
|
|
func NewExampleClient(serviceName string, c client.Client) ExampleClient {
|
2015-12-02 22:44:01 +00:00
|
|
|
if c == nil {
|
|
|
|
c = client.NewClient()
|
|
|
|
}
|
2015-12-06 22:44:17 +00:00
|
|
|
if len(serviceName) == 0 {
|
|
|
|
serviceName = "go.micro.srv.example"
|
|
|
|
}
|
2015-12-02 22:44:01 +00:00
|
|
|
return &exampleClient{
|
2015-12-06 22:44:17 +00:00
|
|
|
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) {
|
2015-12-06 22:44:17 +00:00
|
|
|
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-06 22:44:17 +00:00
|
|
|
req := c.c.NewRequest(c.serviceName, "Example.Stream", in)
|
2015-12-02 22:44:01 +00:00
|
|
|
outCh := make(chan *StreamingResponse)
|
2015-12-09 21:41:55 +00:00
|
|
|
stream, err := c.c.Stream(ctx, req, outCh, opts...)
|
2015-12-02 22:44:01 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return &exampleStreamClient{stream, outCh}, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
type Example_StreamClient interface {
|
|
|
|
Next() (*StreamingResponse, error)
|
|
|
|
client.Streamer
|
|
|
|
}
|
|
|
|
|
|
|
|
type exampleStreamClient struct {
|
|
|
|
client.Streamer
|
|
|
|
next chan *StreamingResponse
|
|
|
|
}
|
|
|
|
|
|
|
|
func (x *exampleStreamClient) Next() (*StreamingResponse, error) {
|
|
|
|
out, ok := <-x.next
|
|
|
|
if !ok {
|
|
|
|
return nil, fmt.Errorf(`chan closed`)
|
|
|
|
}
|
|
|
|
return out, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// Server API for Example service
|
|
|
|
|
2015-12-06 22:44:17 +00:00
|
|
|
type ExampleHandler interface {
|
2015-12-02 23:05:52 +00:00
|
|
|
Call(context.Context, *Request, *Response) error
|
|
|
|
Stream(context.Context, func(*StreamingResponse) error) error
|
2015-12-02 22:44:01 +00:00
|
|
|
}
|
|
|
|
|
2015-12-06 22:44:17 +00:00
|
|
|
func RegisterExampleHandler(s server.Server, hdlr ExampleHandler) {
|
|
|
|
s.Handle(s.NewHandler(hdlr))
|
2015-12-02 22:44:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
var fileDescriptor0 = []byte{
|
2015-12-06 22:44:17 +00:00
|
|
|
// 230 bytes of a gzipped FileDescriptorProto
|
|
|
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x84, 0x90, 0xcd, 0x4a, 0xc5, 0x30,
|
|
|
|
0x10, 0x85, 0x0d, 0xf7, 0x7a, 0xab, 0xa3, 0x82, 0x06, 0x51, 0x29, 0x28, 0x9a, 0x85, 0xba, 0x31,
|
|
|
|
0x15, 0xf5, 0x0d, 0x44, 0x5c, 0xb9, 0xa9, 0x6b, 0x17, 0xb1, 0x0c, 0xa1, 0xd0, 0x24, 0x35, 0x93,
|
|
|
|
0x16, 0x7d, 0x2c, 0xdf, 0x50, 0x48, 0xd3, 0xa2, 0x52, 0x71, 0x15, 0x98, 0xf3, 0x9d, 0x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