Files
full/module/ec/order/pb/cart_grpc.pb.go

247 lines
8.5 KiB
Go

// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.2
// - protoc v7.35.1
// source: module/ec/order/proto/cart.proto
package order
import (
protobuf "bsm/full/protobuf"
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 (
Cart_Fetch_FullMethodName = "/order.Cart/Fetch"
Cart_Create_FullMethodName = "/order.Cart/Create"
Cart_Modify_FullMethodName = "/order.Cart/Modify"
Cart_Delete_FullMethodName = "/order.Cart/Delete"
)
// CartClient is the client API for Cart 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.
//
// Order(订单)微服务-购物车
type CartClient interface {
// 获取购物车的商品数据
Fetch(ctx context.Context, in *CartGetRequest, opts ...grpc.CallOption) (*CartGetReply, error)
// 将商品增加至购物车
Create(ctx context.Context, in *CartAddRequest, opts ...grpc.CallOption) (*protobuf.OrderStatusReply, error)
// 修改购物车中的商品数量
Modify(ctx context.Context, in *CartSetRequest, opts ...grpc.CallOption) (*protobuf.OrderStatusReply, error)
// 删除购物车中的商品
Delete(ctx context.Context, in *CartDelRequest, opts ...grpc.CallOption) (*protobuf.OrderStatusReply, error)
}
type cartClient struct {
cc grpc.ClientConnInterface
}
func NewCartClient(cc grpc.ClientConnInterface) CartClient {
return &cartClient{cc}
}
func (c *cartClient) Fetch(ctx context.Context, in *CartGetRequest, opts ...grpc.CallOption) (*CartGetReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(CartGetReply)
err := c.cc.Invoke(ctx, Cart_Fetch_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *cartClient) Create(ctx context.Context, in *CartAddRequest, opts ...grpc.CallOption) (*protobuf.OrderStatusReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(protobuf.OrderStatusReply)
err := c.cc.Invoke(ctx, Cart_Create_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *cartClient) Modify(ctx context.Context, in *CartSetRequest, opts ...grpc.CallOption) (*protobuf.OrderStatusReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(protobuf.OrderStatusReply)
err := c.cc.Invoke(ctx, Cart_Modify_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *cartClient) Delete(ctx context.Context, in *CartDelRequest, opts ...grpc.CallOption) (*protobuf.OrderStatusReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(protobuf.OrderStatusReply)
err := c.cc.Invoke(ctx, Cart_Delete_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// CartServer is the server API for Cart service.
// All implementations should embed UnimplementedCartServer
// for forward compatibility.
//
// Order(订单)微服务-购物车
type CartServer interface {
// 获取购物车的商品数据
Fetch(context.Context, *CartGetRequest) (*CartGetReply, error)
// 将商品增加至购物车
Create(context.Context, *CartAddRequest) (*protobuf.OrderStatusReply, error)
// 修改购物车中的商品数量
Modify(context.Context, *CartSetRequest) (*protobuf.OrderStatusReply, error)
// 删除购物车中的商品
Delete(context.Context, *CartDelRequest) (*protobuf.OrderStatusReply, error)
}
// UnimplementedCartServer should 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 UnimplementedCartServer struct{}
func (UnimplementedCartServer) Fetch(context.Context, *CartGetRequest) (*CartGetReply, error) {
return nil, status.Error(codes.Unimplemented, "method Fetch not implemented")
}
func (UnimplementedCartServer) Create(context.Context, *CartAddRequest) (*protobuf.OrderStatusReply, error) {
return nil, status.Error(codes.Unimplemented, "method Create not implemented")
}
func (UnimplementedCartServer) Modify(context.Context, *CartSetRequest) (*protobuf.OrderStatusReply, error) {
return nil, status.Error(codes.Unimplemented, "method Modify not implemented")
}
func (UnimplementedCartServer) Delete(context.Context, *CartDelRequest) (*protobuf.OrderStatusReply, error) {
return nil, status.Error(codes.Unimplemented, "method Delete not implemented")
}
func (UnimplementedCartServer) testEmbeddedByValue() {}
// UnsafeCartServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to CartServer will
// result in compilation errors.
type UnsafeCartServer interface {
mustEmbedUnimplementedCartServer()
}
func RegisterCartServer(s grpc.ServiceRegistrar, srv CartServer) {
// If the following call panics, it indicates UnimplementedCartServer 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(&Cart_ServiceDesc, srv)
}
func _Cart_Fetch_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CartGetRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(CartServer).Fetch(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Cart_Fetch_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(CartServer).Fetch(ctx, req.(*CartGetRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Cart_Create_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CartAddRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(CartServer).Create(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Cart_Create_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(CartServer).Create(ctx, req.(*CartAddRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Cart_Modify_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CartSetRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(CartServer).Modify(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Cart_Modify_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(CartServer).Modify(ctx, req.(*CartSetRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Cart_Delete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CartDelRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(CartServer).Delete(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Cart_Delete_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(CartServer).Delete(ctx, req.(*CartDelRequest))
}
return interceptor(ctx, in, info, handler)
}
// Cart_ServiceDesc is the grpc.ServiceDesc for Cart service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Cart_ServiceDesc = grpc.ServiceDesc{
ServiceName: "order.Cart",
HandlerType: (*CartServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Fetch",
Handler: _Cart_Fetch_Handler,
},
{
MethodName: "Create",
Handler: _Cart_Create_Handler,
},
{
MethodName: "Modify",
Handler: _Cart_Modify_Handler,
},
{
MethodName: "Delete",
Handler: _Cart_Delete_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "module/ec/order/proto/cart.proto",
}