github.com/micro/go-micro/examples@v0.0.0-20210105173217-bf4ab679e18b/helloworld/proto/greeter.pb.micro.go (about) 1 // Code generated by protoc-gen-micro. DO NOT EDIT. 2 // source: github.com/micro/go-micro/examples/helloworld/proto/greeter.proto 3 4 package greeter 5 6 import ( 7 fmt "fmt" 8 proto "github.com/golang/protobuf/proto" 9 math "math" 10 ) 11 12 import ( 13 context "context" 14 client "github.com/micro/go-micro/v2/client" 15 server "github.com/micro/go-micro/v2/server" 16 ) 17 18 // Reference imports to suppress errors if they are not otherwise used. 19 var _ = proto.Marshal 20 var _ = fmt.Errorf 21 var _ = math.Inf 22 23 // This is a compile-time assertion to ensure that this generated file 24 // is compatible with the proto package it is being compiled against. 25 // A compilation error at this line likely means your copy of the 26 // proto package needs to be updated. 27 const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package 28 29 // Reference imports to suppress errors if they are not otherwise used. 30 var _ context.Context 31 var _ client.Option 32 var _ server.Option 33 34 // Client API for Greeter service 35 36 type GreeterService interface { 37 Hello(ctx context.Context, in *Request, opts ...client.CallOption) (*Response, error) 38 } 39 40 type greeterService struct { 41 c client.Client 42 name string 43 } 44 45 func NewGreeterService(name string, c client.Client) GreeterService { 46 return &greeterService{ 47 c: c, 48 name: name, 49 } 50 } 51 52 func (c *greeterService) Hello(ctx context.Context, in *Request, opts ...client.CallOption) (*Response, error) { 53 req := c.c.NewRequest(c.name, "Greeter.Hello", in) 54 out := new(Response) 55 err := c.c.Call(ctx, req, out, opts...) 56 if err != nil { 57 return nil, err 58 } 59 return out, nil 60 } 61 62 // Server API for Greeter service 63 64 type GreeterHandler interface { 65 Hello(context.Context, *Request, *Response) error 66 } 67 68 func RegisterGreeterHandler(s server.Server, hdlr GreeterHandler, opts ...server.HandlerOption) error { 69 type greeter interface { 70 Hello(ctx context.Context, in *Request, out *Response) error 71 } 72 type Greeter struct { 73 greeter 74 } 75 h := &greeterHandler{hdlr} 76 return s.Handle(s.NewHandler(&Greeter{h}, opts...)) 77 } 78 79 type greeterHandler struct { 80 GreeterHandler 81 } 82 83 func (h *greeterHandler) Hello(ctx context.Context, in *Request, out *Response) error { 84 return h.GreeterHandler.Hello(ctx, in, out) 85 }