github.com/micro/go-micro/examples@v0.0.0-20210105173217-bf4ab679e18b/kubernetes/examples/greeter/proto/hello/hello.pb.micro.go (about)

     1  // Code generated by protoc-gen-micro. DO NOT EDIT.
     2  // source: proto/hello/hello.proto
     3  
     4  package go_micro_srv_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 Say service
    35  
    36  type SayService interface {
    37  	Hello(ctx context.Context, in *Request, opts ...client.CallOption) (*Response, error)
    38  }
    39  
    40  type sayService struct {
    41  	c    client.Client
    42  	name string
    43  }
    44  
    45  func NewSayService(name string, c client.Client) SayService {
    46  	return &sayService{
    47  		c:    c,
    48  		name: name,
    49  	}
    50  }
    51  
    52  func (c *sayService) Hello(ctx context.Context, in *Request, opts ...client.CallOption) (*Response, error) {
    53  	req := c.c.NewRequest(c.name, "Say.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 Say service
    63  
    64  type SayHandler interface {
    65  	Hello(context.Context, *Request, *Response) error
    66  }
    67  
    68  func RegisterSayHandler(s server.Server, hdlr SayHandler, opts ...server.HandlerOption) error {
    69  	type say interface {
    70  		Hello(ctx context.Context, in *Request, out *Response) error
    71  	}
    72  	type Say struct {
    73  		say
    74  	}
    75  	h := &sayHandler{hdlr}
    76  	return s.Handle(s.NewHandler(&Say{h}, opts...))
    77  }
    78  
    79  type sayHandler struct {
    80  	SayHandler
    81  }
    82  
    83  func (h *sayHandler) Hello(ctx context.Context, in *Request, out *Response) error {
    84  	return h.SayHandler.Hello(ctx, in, out)
    85  }