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