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