go17/devcloud-mini/cmdb/apps/resource/service_grpc.pb.go
2025-03-02 16:29:27 +08:00

164 lines
5.4 KiB
Go

// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.5.1
// - protoc v5.29.3
// source: cmdb/apps/resource/service.proto
package resource
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
Rpc_Search_FullMethodName = "/go17.cmdb.resource.Rpc/Search"
Rpc_Save_FullMethodName = "/go17.cmdb.resource.Rpc/Save"
)
// RpcClient is the client API for Rpc service.
//
// 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.
type RpcClient interface {
// 资源搜索
Search(ctx context.Context, in *SearchRequest, opts ...grpc.CallOption) (*ResourceSet, error)
// Save 更新与创建同时
Save(ctx context.Context, in *Resource, opts ...grpc.CallOption) (*Resource, error)
}
type rpcClient struct {
cc grpc.ClientConnInterface
}
func NewRpcClient(cc grpc.ClientConnInterface) RpcClient {
return &rpcClient{cc}
}
func (c *rpcClient) Search(ctx context.Context, in *SearchRequest, opts ...grpc.CallOption) (*ResourceSet, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ResourceSet)
err := c.cc.Invoke(ctx, Rpc_Search_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *rpcClient) Save(ctx context.Context, in *Resource, opts ...grpc.CallOption) (*Resource, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(Resource)
err := c.cc.Invoke(ctx, Rpc_Save_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// RpcServer is the server API for Rpc service.
// All implementations must embed UnimplementedRpcServer
// for forward compatibility.
type RpcServer interface {
// 资源搜索
Search(context.Context, *SearchRequest) (*ResourceSet, error)
// Save 更新与创建同时
Save(context.Context, *Resource) (*Resource, error)
mustEmbedUnimplementedRpcServer()
}
// UnimplementedRpcServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedRpcServer struct{}
func (UnimplementedRpcServer) Search(context.Context, *SearchRequest) (*ResourceSet, error) {
return nil, status.Errorf(codes.Unimplemented, "method Search not implemented")
}
func (UnimplementedRpcServer) Save(context.Context, *Resource) (*Resource, error) {
return nil, status.Errorf(codes.Unimplemented, "method Save not implemented")
}
func (UnimplementedRpcServer) mustEmbedUnimplementedRpcServer() {}
func (UnimplementedRpcServer) testEmbeddedByValue() {}
// UnsafeRpcServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to RpcServer will
// result in compilation errors.
type UnsafeRpcServer interface {
mustEmbedUnimplementedRpcServer()
}
func RegisterRpcServer(s grpc.ServiceRegistrar, srv RpcServer) {
// If the following call pancis, it indicates UnimplementedRpcServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&Rpc_ServiceDesc, srv)
}
func _Rpc_Search_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(SearchRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(RpcServer).Search(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Rpc_Search_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(RpcServer).Search(ctx, req.(*SearchRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Rpc_Save_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(Resource)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(RpcServer).Save(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Rpc_Save_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(RpcServer).Save(ctx, req.(*Resource))
}
return interceptor(ctx, in, info, handler)
}
// Rpc_ServiceDesc is the grpc.ServiceDesc for Rpc service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Rpc_ServiceDesc = grpc.ServiceDesc{
ServiceName: "go17.cmdb.resource.Rpc",
HandlerType: (*RpcServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Search",
Handler: _Rpc_Search_Handler,
},
{
MethodName: "Save",
Handler: _Rpc_Save_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "cmdb/apps/resource/service.proto",
}