github.com/lastbackend/toolkit@v0.0.0-20241020043710-cafa37b95aad/examples/http/gen/server/server_grpc.pb.go (about) 1 // Code generated by protoc-gen-go-grpc. DO NOT EDIT. 2 // versions: 3 // - protoc-gen-go-grpc v1.3.0 4 // - protoc v4.25.2 5 // source: github.com/lastbackend/toolkit/examples/http/apis/server.proto 6 7 package serverpb 8 9 import ( 10 context "context" 11 grpc "google.golang.org/grpc" 12 codes "google.golang.org/grpc/codes" 13 status "google.golang.org/grpc/status" 14 ) 15 16 // This is a compile-time assertion to ensure that this generated file 17 // is compatible with the grpc package it is being compiled against. 18 // Requires gRPC-Go v1.32.0 or later. 19 const _ = grpc.SupportPackageIsVersion7 20 21 const ( 22 Http_HelloWorld_FullMethodName = "/http.Http/HelloWorld" 23 ) 24 25 // HttpClient is the client API for Http service. 26 // 27 // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. 28 type HttpClient interface { 29 HelloWorld(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloResponse, error) 30 } 31 32 type httpClient struct { 33 cc grpc.ClientConnInterface 34 } 35 36 func NewHttpClient(cc grpc.ClientConnInterface) HttpClient { 37 return &httpClient{cc} 38 } 39 40 func (c *httpClient) HelloWorld(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloResponse, error) { 41 out := new(HelloResponse) 42 err := c.cc.Invoke(ctx, Http_HelloWorld_FullMethodName, in, out, opts...) 43 if err != nil { 44 return nil, err 45 } 46 return out, nil 47 } 48 49 // HttpServer is the server API for Http service. 50 // All implementations should embed UnimplementedHttpServer 51 // for forward compatibility 52 type HttpServer interface { 53 HelloWorld(context.Context, *HelloRequest) (*HelloResponse, error) 54 } 55 56 // UnimplementedHttpServer should be embedded to have forward compatible implementations. 57 type UnimplementedHttpServer struct { 58 } 59 60 func (UnimplementedHttpServer) HelloWorld(context.Context, *HelloRequest) (*HelloResponse, error) { 61 return nil, status.Errorf(codes.Unimplemented, "method HelloWorld not implemented") 62 } 63 64 // UnsafeHttpServer may be embedded to opt out of forward compatibility for this service. 65 // Use of this interface is not recommended, as added methods to HttpServer will 66 // result in compilation errors. 67 type UnsafeHttpServer interface { 68 mustEmbedUnimplementedHttpServer() 69 } 70 71 func RegisterHttpServer(s grpc.ServiceRegistrar, srv HttpServer) { 72 s.RegisterService(&Http_ServiceDesc, srv) 73 } 74 75 func _Http_HelloWorld_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 76 in := new(HelloRequest) 77 if err := dec(in); err != nil { 78 return nil, err 79 } 80 if interceptor == nil { 81 return srv.(HttpServer).HelloWorld(ctx, in) 82 } 83 info := &grpc.UnaryServerInfo{ 84 Server: srv, 85 FullMethod: Http_HelloWorld_FullMethodName, 86 } 87 handler := func(ctx context.Context, req interface{}) (interface{}, error) { 88 return srv.(HttpServer).HelloWorld(ctx, req.(*HelloRequest)) 89 } 90 return interceptor(ctx, in, info, handler) 91 } 92 93 // Http_ServiceDesc is the grpc.ServiceDesc for Http service. 94 // It's only intended for direct use with grpc.RegisterService, 95 // and not to be introspected or modified (even as a copy) 96 var Http_ServiceDesc = grpc.ServiceDesc{ 97 ServiceName: "http.Http", 98 HandlerType: (*HttpServer)(nil), 99 Methods: []grpc.MethodDesc{ 100 { 101 MethodName: "HelloWorld", 102 Handler: _Http_HelloWorld_Handler, 103 }, 104 }, 105 Streams: []grpc.StreamDesc{}, 106 Metadata: "github.com/lastbackend/toolkit/examples/http/apis/server.proto", 107 }