add search
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-05-30 04:17:13 +07:00
parent 073a7e6d8c
commit 8be5d0b831
9 changed files with 320 additions and 53 deletions
+37
View File
@@ -27,6 +27,7 @@ const (
CRM_Order_FullMethodName = "/crabs.crm.CRM/Order"
CRM_GetCart_FullMethodName = "/crabs.crm.CRM/GetCart"
CRM_GetImage_FullMethodName = "/crabs.crm.CRM/GetImage"
CRM_Search_FullMethodName = "/crabs.crm.CRM/Search"
)
// CRMClient is the client API for CRM service.
@@ -40,6 +41,7 @@ type CRMClient interface {
Order(ctx context.Context, in *OrderReq, opts ...grpc.CallOption) (*OrderRsp, error)
GetCart(ctx context.Context, in *CartReq, opts ...grpc.CallOption) (*CartRsp, error)
GetImage(ctx context.Context, in *GetImageReq, opts ...grpc.CallOption) (*httpbody.HttpBody, error)
Search(ctx context.Context, in *SearchReq, opts ...grpc.CallOption) (*PositionsRsp, error)
}
type cRMClient struct {
@@ -113,6 +115,15 @@ func (c *cRMClient) GetImage(ctx context.Context, in *GetImageReq, opts ...grpc.
return out, nil
}
func (c *cRMClient) Search(ctx context.Context, in *SearchReq, opts ...grpc.CallOption) (*PositionsRsp, error) {
out := new(PositionsRsp)
err := c.cc.Invoke(ctx, CRM_Search_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// CRMServer is the server API for CRM service.
// All implementations must embed UnimplementedCRMServer
// for forward compatibility
@@ -124,6 +135,7 @@ type CRMServer interface {
Order(context.Context, *OrderReq) (*OrderRsp, error)
GetCart(context.Context, *CartReq) (*CartRsp, error)
GetImage(context.Context, *GetImageReq) (*httpbody.HttpBody, error)
Search(context.Context, *SearchReq) (*PositionsRsp, error)
mustEmbedUnimplementedCRMServer()
}
@@ -152,6 +164,9 @@ func (UnimplementedCRMServer) GetCart(context.Context, *CartReq) (*CartRsp, erro
func (UnimplementedCRMServer) GetImage(context.Context, *GetImageReq) (*httpbody.HttpBody, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetImage not implemented")
}
func (UnimplementedCRMServer) Search(context.Context, *SearchReq) (*PositionsRsp, error) {
return nil, status.Errorf(codes.Unimplemented, "method Search not implemented")
}
func (UnimplementedCRMServer) mustEmbedUnimplementedCRMServer() {}
// UnsafeCRMServer may be embedded to opt out of forward compatibility for this service.
@@ -291,6 +306,24 @@ func _CRM_GetImage_Handler(srv interface{}, ctx context.Context, dec func(interf
return interceptor(ctx, in, info, handler)
}
func _CRM_Search_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(SearchReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(CRMServer).Search(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: CRM_Search_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(CRMServer).Search(ctx, req.(*SearchReq))
}
return interceptor(ctx, in, info, handler)
}
// CRM_ServiceDesc is the grpc.ServiceDesc for CRM service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
@@ -326,6 +359,10 @@ var CRM_ServiceDesc = grpc.ServiceDesc{
MethodName: "GetImage",
Handler: _CRM_GetImage_Handler,
},
{
MethodName: "Search",
Handler: _CRM_Search_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "main.proto",