185 lines
6.5 KiB
Go
185 lines
6.5 KiB
Go
// Code generated by protoc-gen-go.
|
|
// source: go-micro/examples/server/proto/example/example.proto
|
|
// DO NOT EDIT!
|
|
|
|
/*
|
|
Package go_micro_srv_example is a generated protocol buffer package.
|
|
|
|
It is generated from these files:
|
|
go-micro/examples/server/proto/example/example.proto
|
|
|
|
It has these top-level messages:
|
|
Message
|
|
Request
|
|
Response
|
|
StreamingRequest
|
|
StreamingResponse
|
|
*/
|
|
package go_micro_srv_example
|
|
|
|
import proto "github.com/golang/protobuf/proto"
|
|
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"
|
|
)
|
|
|
|
// Reference imports to suppress errors if they are not otherwise used.
|
|
var _ = proto.Marshal
|
|
var _ = fmt.Errorf
|
|
var _ = math.Inf
|
|
|
|
type Message struct {
|
|
Say string `protobuf:"bytes,1,opt,name=say" json:"say,omitempty"`
|
|
}
|
|
|
|
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} }
|
|
|
|
type Request struct {
|
|
Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
|
|
}
|
|
|
|
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} }
|
|
|
|
type Response struct {
|
|
Msg string `protobuf:"bytes,1,opt,name=msg" json:"msg,omitempty"`
|
|
}
|
|
|
|
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} }
|
|
|
|
type StreamingRequest struct {
|
|
Count int64 `protobuf:"varint,1,opt,name=count" json:"count,omitempty"`
|
|
}
|
|
|
|
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"`
|
|
}
|
|
|
|
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} }
|
|
|
|
func init() {
|
|
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 {
|
|
Call(ctx context.Context, in *Request, opts ...client.CallOption) (*Response, error)
|
|
Stream(ctx context.Context, in *StreamingRequest, opts ...client.CallOption) (Example_StreamClient, error)
|
|
}
|
|
|
|
type exampleClient struct {
|
|
c client.Client
|
|
serviceName string
|
|
}
|
|
|
|
func NewExampleClient(serviceName string, c client.Client) ExampleClient {
|
|
if c == nil {
|
|
c = client.NewClient()
|
|
}
|
|
if len(serviceName) == 0 {
|
|
serviceName = "go.micro.srv.example"
|
|
}
|
|
return &exampleClient{
|
|
c: c,
|
|
serviceName: serviceName,
|
|
}
|
|
}
|
|
|
|
func (c *exampleClient) Call(ctx context.Context, in *Request, opts ...client.CallOption) (*Response, error) {
|
|
req := c.c.NewRequest(c.serviceName, "Example.Call", in)
|
|
out := new(Response)
|
|
err := c.c.Call(ctx, req, out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *exampleClient) Stream(ctx context.Context, in *StreamingRequest, opts ...client.CallOption) (Example_StreamClient, error) {
|
|
req := c.c.NewRequest(c.serviceName, "Example.Stream", in)
|
|
outCh := make(chan *StreamingResponse)
|
|
stream, err := c.c.Stream(ctx, req, outCh, opts...)
|
|
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
|
|
|
|
type ExampleHandler interface {
|
|
Call(context.Context, *Request, *Response) error
|
|
Stream(context.Context, func(*StreamingResponse) error) error
|
|
}
|
|
|
|
func RegisterExampleHandler(s server.Server, hdlr ExampleHandler) {
|
|
s.Handle(s.NewHandler(hdlr))
|
|
}
|
|
|
|
var fileDescriptor0 = []byte{
|
|
// 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, 0x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