github.com/tickoalcantara12/micro/v3@v3.0.0-20221007104245-9d75b9bcbab9/service/client/grpc/proto/helloworld.pb.micro.go (about)

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