github.com/micro/go-micro/examples@v0.0.0-20210105173217-bf4ab679e18b/booking/api/hotel/proto/hotel.micro.go (about) 1 // Code generated by protoc-gen-micro. DO NOT EDIT. 2 // source: github.com/micro/go-micro/examples/booking/api/hotel/proto/hotel.proto 3 4 /* 5 Package hotel is a generated protocol buffer package. 6 7 It is generated from these files: 8 github.com/micro/go-micro/examples/booking/api/hotel/proto/hotel.proto 9 10 It has these top-level messages: 11 Request 12 Response 13 */ 14 package hotel 15 16 import proto "github.com/golang/protobuf/proto" 17 import fmt "fmt" 18 import math "math" 19 import _ "github.com/micro/go-micro/examples/booking/srv/profile/proto" 20 import _ "github.com/micro/go-micro/examples/booking/srv/rate/proto" 21 22 import ( 23 context "context" 24 client "github.com/micro/go-micro/v2/client" 25 server "github.com/micro/go-micro/v2/server" 26 ) 27 28 // Reference imports to suppress errors if they are not otherwise used. 29 var _ = proto.Marshal 30 var _ = fmt.Errorf 31 var _ = math.Inf 32 33 // This is a compile-time assertion to ensure that this generated file 34 // is compatible with the proto package it is being compiled against. 35 // A compilation error at this line likely means your copy of the 36 // proto package needs to be updated. 37 const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package 38 39 // Reference imports to suppress errors if they are not otherwise used. 40 var _ context.Context 41 var _ client.Option 42 var _ server.Option 43 44 // Client API for Hotel service 45 46 type HotelService interface { 47 Rates(ctx context.Context, in *Request, opts ...client.CallOption) (*Response, error) 48 } 49 50 type hotelService struct { 51 c client.Client 52 serviceName string 53 } 54 55 func NewHotelService(serviceName string, c client.Client) HotelService { 56 if c == nil { 57 c = client.NewClient() 58 } 59 if len(serviceName) == 0 { 60 serviceName = "hotel" 61 } 62 return &hotelService{ 63 c: c, 64 serviceName: serviceName, 65 } 66 } 67 68 func (c *hotelService) Rates(ctx context.Context, in *Request, opts ...client.CallOption) (*Response, error) { 69 req := c.c.NewRequest(c.serviceName, "Hotel.Rates", in) 70 out := new(Response) 71 err := c.c.Call(ctx, req, out, opts...) 72 if err != nil { 73 return nil, err 74 } 75 return out, nil 76 } 77 78 // Server API for Hotel service 79 80 type HotelHandler interface { 81 Rates(context.Context, *Request, *Response) error 82 } 83 84 func RegisterHotelHandler(s server.Server, hdlr HotelHandler, opts ...server.HandlerOption) { 85 type hotel interface { 86 Rates(ctx context.Context, in *Request, out *Response) error 87 } 88 type Hotel struct { 89 hotel 90 } 91 h := &hotelHandler{hdlr} 92 s.Handle(s.NewHandler(&Hotel{h}, opts...)) 93 } 94 95 type hotelHandler struct { 96 HotelHandler 97 } 98 99 func (h *hotelHandler) Rates(ctx context.Context, in *Request, out *Response) error { 100 return h.HotelHandler.Rates(ctx, in, out) 101 }