app-cloudep-product-service/gen_result/pb/product/product_grpc.pb.go

286 lines
11 KiB
Go

// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.5.1
// - protoc v3.19.4
// source: generate/protobuf/product.proto
package product
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 (
Product_CreateCategory_FullMethodName = "/product.Product/CreateCategory"
Product_ModifyCategory_FullMethodName = "/product.Product/ModifyCategory"
Product_DeleteCategory_FullMethodName = "/product.Product/DeleteCategory"
Product_GetCategory_FullMethodName = "/product.Product/GetCategory"
Product_ListCategory_FullMethodName = "/product.Product/ListCategory"
)
// ProductClient is the client API for Product 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 ProductClient interface {
// ====================== Category Service Start ======================
// CreateCategory 建立 product 分類
CreateCategory(ctx context.Context, in *CreateCategoryReq, opts ...grpc.CallOption) (*OKResp, error)
// ModifyCategory 修改 product 分類名稱
ModifyCategory(ctx context.Context, in *ModifyCategoryReq, opts ...grpc.CallOption) (*OKResp, error)
// DeleteCategory 刪除 product 分類
DeleteCategory(ctx context.Context, in *CategoryReq, opts ...grpc.CallOption) (*OKResp, error)
// GetCategory 取得 product 分類
GetCategory(ctx context.Context, in *CategoryReq, opts ...grpc.CallOption) (*Category, error)
// CreateCategory 建立 product 分類
ListCategory(ctx context.Context, in *ListCategoryReq, opts ...grpc.CallOption) (*ListCategoryResp, error)
}
type productClient struct {
cc grpc.ClientConnInterface
}
func NewProductClient(cc grpc.ClientConnInterface) ProductClient {
return &productClient{cc}
}
func (c *productClient) CreateCategory(ctx context.Context, in *CreateCategoryReq, opts ...grpc.CallOption) (*OKResp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(OKResp)
err := c.cc.Invoke(ctx, Product_CreateCategory_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *productClient) ModifyCategory(ctx context.Context, in *ModifyCategoryReq, opts ...grpc.CallOption) (*OKResp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(OKResp)
err := c.cc.Invoke(ctx, Product_ModifyCategory_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *productClient) DeleteCategory(ctx context.Context, in *CategoryReq, opts ...grpc.CallOption) (*OKResp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(OKResp)
err := c.cc.Invoke(ctx, Product_DeleteCategory_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *productClient) GetCategory(ctx context.Context, in *CategoryReq, opts ...grpc.CallOption) (*Category, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(Category)
err := c.cc.Invoke(ctx, Product_GetCategory_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *productClient) ListCategory(ctx context.Context, in *ListCategoryReq, opts ...grpc.CallOption) (*ListCategoryResp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ListCategoryResp)
err := c.cc.Invoke(ctx, Product_ListCategory_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// ProductServer is the server API for Product service.
// All implementations must embed UnimplementedProductServer
// for forward compatibility.
type ProductServer interface {
// ====================== Category Service Start ======================
// CreateCategory 建立 product 分類
CreateCategory(context.Context, *CreateCategoryReq) (*OKResp, error)
// ModifyCategory 修改 product 分類名稱
ModifyCategory(context.Context, *ModifyCategoryReq) (*OKResp, error)
// DeleteCategory 刪除 product 分類
DeleteCategory(context.Context, *CategoryReq) (*OKResp, error)
// GetCategory 取得 product 分類
GetCategory(context.Context, *CategoryReq) (*Category, error)
// CreateCategory 建立 product 分類
ListCategory(context.Context, *ListCategoryReq) (*ListCategoryResp, error)
mustEmbedUnimplementedProductServer()
}
// UnimplementedProductServer 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 UnimplementedProductServer struct{}
func (UnimplementedProductServer) CreateCategory(context.Context, *CreateCategoryReq) (*OKResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method CreateCategory not implemented")
}
func (UnimplementedProductServer) ModifyCategory(context.Context, *ModifyCategoryReq) (*OKResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method ModifyCategory not implemented")
}
func (UnimplementedProductServer) DeleteCategory(context.Context, *CategoryReq) (*OKResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method DeleteCategory not implemented")
}
func (UnimplementedProductServer) GetCategory(context.Context, *CategoryReq) (*Category, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetCategory not implemented")
}
func (UnimplementedProductServer) ListCategory(context.Context, *ListCategoryReq) (*ListCategoryResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method ListCategory not implemented")
}
func (UnimplementedProductServer) mustEmbedUnimplementedProductServer() {}
func (UnimplementedProductServer) testEmbeddedByValue() {}
// UnsafeProductServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to ProductServer will
// result in compilation errors.
type UnsafeProductServer interface {
mustEmbedUnimplementedProductServer()
}
func RegisterProductServer(s grpc.ServiceRegistrar, srv ProductServer) {
// If the following call pancis, it indicates UnimplementedProductServer 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(&Product_ServiceDesc, srv)
}
func _Product_CreateCategory_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CreateCategoryReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ProductServer).CreateCategory(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Product_CreateCategory_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ProductServer).CreateCategory(ctx, req.(*CreateCategoryReq))
}
return interceptor(ctx, in, info, handler)
}
func _Product_ModifyCategory_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ModifyCategoryReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ProductServer).ModifyCategory(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Product_ModifyCategory_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ProductServer).ModifyCategory(ctx, req.(*ModifyCategoryReq))
}
return interceptor(ctx, in, info, handler)
}
func _Product_DeleteCategory_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CategoryReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ProductServer).DeleteCategory(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Product_DeleteCategory_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ProductServer).DeleteCategory(ctx, req.(*CategoryReq))
}
return interceptor(ctx, in, info, handler)
}
func _Product_GetCategory_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CategoryReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ProductServer).GetCategory(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Product_GetCategory_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ProductServer).GetCategory(ctx, req.(*CategoryReq))
}
return interceptor(ctx, in, info, handler)
}
func _Product_ListCategory_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ListCategoryReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ProductServer).ListCategory(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Product_ListCategory_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ProductServer).ListCategory(ctx, req.(*ListCategoryReq))
}
return interceptor(ctx, in, info, handler)
}
// Product_ServiceDesc is the grpc.ServiceDesc for Product service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Product_ServiceDesc = grpc.ServiceDesc{
ServiceName: "product.Product",
HandlerType: (*ProductServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "CreateCategory",
Handler: _Product_CreateCategory_Handler,
},
{
MethodName: "ModifyCategory",
Handler: _Product_ModifyCategory_Handler,
},
{
MethodName: "DeleteCategory",
Handler: _Product_DeleteCategory_Handler,
},
{
MethodName: "GetCategory",
Handler: _Product_GetCategory_Handler,
},
{
MethodName: "ListCategory",
Handler: _Product_ListCategory_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "generate/protobuf/product.proto",
}