feat: product store
This commit is contained in:
+590
-494
File diff suppressed because it is too large
Load Diff
@@ -19,18 +19,24 @@ import (
|
||||
const _ = grpc.SupportPackageIsVersion9
|
||||
|
||||
const (
|
||||
Product_Add_FullMethodName = "/product.Product/Add"
|
||||
Product_Edit_FullMethodName = "/product.Product/Edit"
|
||||
Product_Items_FullMethodName = "/product.Product/Items"
|
||||
Product_Create_FullMethodName = "/product.Product/Create"
|
||||
Product_Info_FullMethodName = "/product.Product/Info"
|
||||
Product_Items_FullMethodName = "/product.Product/Items"
|
||||
Product_Names_FullMethodName = "/product.Product/Names"
|
||||
Product_Status_FullMethodName = "/product.Product/Status"
|
||||
Product_Sort_FullMethodName = "/product.Product/Sort"
|
||||
)
|
||||
|
||||
// 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 {
|
||||
Add(ctx context.Context, in *AddReq, opts ...grpc.CallOption) (*Response, error)
|
||||
Edit(ctx context.Context, in *EditReq, opts ...grpc.CallOption) (*Response, error)
|
||||
Create(ctx context.Context, in *CreateReq, opts ...grpc.CallOption) (*Response, error)
|
||||
Info(ctx context.Context, in *InfoReq, opts ...grpc.CallOption) (*Response, error)
|
||||
Items(ctx context.Context, in *ItemsReq, opts ...grpc.CallOption) (*Response, error)
|
||||
Names(ctx context.Context, in *NamesReq, opts ...grpc.CallOption) (*Response, error)
|
||||
Status(ctx context.Context, in *StatusReq, opts ...grpc.CallOption) (*Response, error)
|
||||
Sort(ctx context.Context, in *SortReq, opts ...grpc.CallOption) (*Response, error)
|
||||
}
|
||||
|
||||
type productClient struct {
|
||||
@@ -41,20 +47,20 @@ func NewProductClient(cc grpc.ClientConnInterface) ProductClient {
|
||||
return &productClient{cc}
|
||||
}
|
||||
|
||||
func (c *productClient) Add(ctx context.Context, in *AddReq, opts ...grpc.CallOption) (*Response, error) {
|
||||
func (c *productClient) Create(ctx context.Context, in *CreateReq, opts ...grpc.CallOption) (*Response, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(Response)
|
||||
err := c.cc.Invoke(ctx, Product_Add_FullMethodName, in, out, cOpts...)
|
||||
err := c.cc.Invoke(ctx, Product_Create_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *productClient) Edit(ctx context.Context, in *EditReq, opts ...grpc.CallOption) (*Response, error) {
|
||||
func (c *productClient) Info(ctx context.Context, in *InfoReq, opts ...grpc.CallOption) (*Response, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(Response)
|
||||
err := c.cc.Invoke(ctx, Product_Edit_FullMethodName, in, out, cOpts...)
|
||||
err := c.cc.Invoke(ctx, Product_Info_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -71,13 +77,46 @@ func (c *productClient) Items(ctx context.Context, in *ItemsReq, opts ...grpc.Ca
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *productClient) Names(ctx context.Context, in *NamesReq, opts ...grpc.CallOption) (*Response, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(Response)
|
||||
err := c.cc.Invoke(ctx, Product_Names_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *productClient) Status(ctx context.Context, in *StatusReq, opts ...grpc.CallOption) (*Response, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(Response)
|
||||
err := c.cc.Invoke(ctx, Product_Status_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *productClient) Sort(ctx context.Context, in *SortReq, opts ...grpc.CallOption) (*Response, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(Response)
|
||||
err := c.cc.Invoke(ctx, Product_Sort_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 {
|
||||
Add(context.Context, *AddReq) (*Response, error)
|
||||
Edit(context.Context, *EditReq) (*Response, error)
|
||||
Create(context.Context, *CreateReq) (*Response, error)
|
||||
Info(context.Context, *InfoReq) (*Response, error)
|
||||
Items(context.Context, *ItemsReq) (*Response, error)
|
||||
Names(context.Context, *NamesReq) (*Response, error)
|
||||
Status(context.Context, *StatusReq) (*Response, error)
|
||||
Sort(context.Context, *SortReq) (*Response, error)
|
||||
mustEmbedUnimplementedProductServer()
|
||||
}
|
||||
|
||||
@@ -88,15 +127,24 @@ type ProductServer interface {
|
||||
// pointer dereference when methods are called.
|
||||
type UnimplementedProductServer struct{}
|
||||
|
||||
func (UnimplementedProductServer) Add(context.Context, *AddReq) (*Response, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method Add not implemented")
|
||||
func (UnimplementedProductServer) Create(context.Context, *CreateReq) (*Response, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method Create not implemented")
|
||||
}
|
||||
func (UnimplementedProductServer) Edit(context.Context, *EditReq) (*Response, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method Edit not implemented")
|
||||
func (UnimplementedProductServer) Info(context.Context, *InfoReq) (*Response, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method Info not implemented")
|
||||
}
|
||||
func (UnimplementedProductServer) Items(context.Context, *ItemsReq) (*Response, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method Items not implemented")
|
||||
}
|
||||
func (UnimplementedProductServer) Names(context.Context, *NamesReq) (*Response, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method Names not implemented")
|
||||
}
|
||||
func (UnimplementedProductServer) Status(context.Context, *StatusReq) (*Response, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method Status not implemented")
|
||||
}
|
||||
func (UnimplementedProductServer) Sort(context.Context, *SortReq) (*Response, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method Sort not implemented")
|
||||
}
|
||||
func (UnimplementedProductServer) mustEmbedUnimplementedProductServer() {}
|
||||
func (UnimplementedProductServer) testEmbeddedByValue() {}
|
||||
|
||||
@@ -118,38 +166,38 @@ func RegisterProductServer(s grpc.ServiceRegistrar, srv ProductServer) {
|
||||
s.RegisterService(&Product_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
func _Product_Add_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(AddReq)
|
||||
func _Product_Create_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(CreateReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ProductServer).Add(ctx, in)
|
||||
return srv.(ProductServer).Create(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Product_Add_FullMethodName,
|
||||
FullMethod: Product_Create_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ProductServer).Add(ctx, req.(*AddReq))
|
||||
return srv.(ProductServer).Create(ctx, req.(*CreateReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Product_Edit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(EditReq)
|
||||
func _Product_Info_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(InfoReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ProductServer).Edit(ctx, in)
|
||||
return srv.(ProductServer).Info(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Product_Edit_FullMethodName,
|
||||
FullMethod: Product_Info_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ProductServer).Edit(ctx, req.(*EditReq))
|
||||
return srv.(ProductServer).Info(ctx, req.(*InfoReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
@@ -172,6 +220,60 @@ func _Product_Items_Handler(srv interface{}, ctx context.Context, dec func(inter
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Product_Names_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(NamesReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ProductServer).Names(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Product_Names_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ProductServer).Names(ctx, req.(*NamesReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Product_Status_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(StatusReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ProductServer).Status(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Product_Status_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ProductServer).Status(ctx, req.(*StatusReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Product_Sort_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(SortReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ProductServer).Sort(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Product_Sort_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ProductServer).Sort(ctx, req.(*SortReq))
|
||||
}
|
||||
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)
|
||||
@@ -180,17 +282,29 @@ var Product_ServiceDesc = grpc.ServiceDesc{
|
||||
HandlerType: (*ProductServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "Add",
|
||||
Handler: _Product_Add_Handler,
|
||||
MethodName: "Create",
|
||||
Handler: _Product_Create_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "Edit",
|
||||
Handler: _Product_Edit_Handler,
|
||||
MethodName: "Info",
|
||||
Handler: _Product_Info_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "Items",
|
||||
Handler: _Product_Items_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "Names",
|
||||
Handler: _Product_Names_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "Status",
|
||||
Handler: _Product_Status_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "Sort",
|
||||
Handler: _Product_Sort_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "proto/admin/product.proto",
|
||||
|
||||
Reference in New Issue
Block a user