Documentation
¶
Index ¶
- Constants
- Variables
- func RegisterCartServiceServer(s grpc.ServiceRegistrar, srv CartServiceServer)
- type AddItemRequest
- func (*AddItemRequest) Descriptor() ([]byte, []int)deprecated
- func (x *AddItemRequest) GetProductId() string
- func (x *AddItemRequest) GetQuantity() int32
- func (x *AddItemRequest) GetUserId() string
- func (*AddItemRequest) ProtoMessage()
- func (x *AddItemRequest) ProtoReflect() protoreflect.Message
- func (x *AddItemRequest) Reset()
- func (x *AddItemRequest) String() string
- type AddItemResponse
- type Cart
- type CartItem
- func (*CartItem) Descriptor() ([]byte, []int)deprecated
- func (x *CartItem) GetLinePrice() float64
- func (x *CartItem) GetProductId() string
- func (x *CartItem) GetQuantity() int32
- func (*CartItem) ProtoMessage()
- func (x *CartItem) ProtoReflect() protoreflect.Message
- func (x *CartItem) Reset()
- func (x *CartItem) String() string
- type CartServiceClient
- type CartServiceServer
- type ClearCartRequest
- type ClearCartResponse
- type GetCartRequest
- type GetCartResponse
- type RemoveItemRequest
- func (*RemoveItemRequest) Descriptor() ([]byte, []int)deprecated
- func (x *RemoveItemRequest) GetProductId() string
- func (x *RemoveItemRequest) GetUserId() string
- func (*RemoveItemRequest) ProtoMessage()
- func (x *RemoveItemRequest) ProtoReflect() protoreflect.Message
- func (x *RemoveItemRequest) Reset()
- func (x *RemoveItemRequest) String() string
- type RemoveItemResponse
- type UnimplementedCartServiceServer
- func (UnimplementedCartServiceServer) AddItem(context.Context, *AddItemRequest) (*AddItemResponse, error)
- func (UnimplementedCartServiceServer) ClearCart(context.Context, *ClearCartRequest) (*ClearCartResponse, error)
- func (UnimplementedCartServiceServer) GetCart(context.Context, *GetCartRequest) (*GetCartResponse, error)
- func (UnimplementedCartServiceServer) RemoveItem(context.Context, *RemoveItemRequest) (*RemoveItemResponse, error)
- type UnsafeCartServiceServer
Constants ¶
const ( CartService_GetCart_FullMethodName = "/cart.v1.CartService/GetCart" CartService_AddItem_FullMethodName = "/cart.v1.CartService/AddItem" CartService_RemoveItem_FullMethodName = "/cart.v1.CartService/RemoveItem" CartService_ClearCart_FullMethodName = "/cart.v1.CartService/ClearCart" )
Variables ¶
var CartService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "cart.v1.CartService", HandlerType: (*CartServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "GetCart", Handler: _CartService_GetCart_Handler, }, { MethodName: "AddItem", Handler: _CartService_AddItem_Handler, }, { MethodName: "RemoveItem", Handler: _CartService_RemoveItem_Handler, }, { MethodName: "ClearCart", Handler: _CartService_ClearCart_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "cart.proto", }
CartService_ServiceDesc is the grpc.ServiceDesc for CartService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
var File_cart_proto protoreflect.FileDescriptor
Functions ¶
func RegisterCartServiceServer ¶
func RegisterCartServiceServer(s grpc.ServiceRegistrar, srv CartServiceServer)
Types ¶
type AddItemRequest ¶
type AddItemRequest struct {
UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`
ProductId string `protobuf:"bytes,2,opt,name=product_id,json=productId,proto3" json:"product_id,omitempty"`
Quantity int32 `protobuf:"varint,3,opt,name=quantity,proto3" json:"quantity,omitempty"`
// contains filtered or unexported fields
}
Request to add an item to the cart.
func (*AddItemRequest) Descriptor
deprecated
func (*AddItemRequest) Descriptor() ([]byte, []int)
Deprecated: Use AddItemRequest.ProtoReflect.Descriptor instead.
func (*AddItemRequest) GetProductId ¶
func (x *AddItemRequest) GetProductId() string
func (*AddItemRequest) GetQuantity ¶
func (x *AddItemRequest) GetQuantity() int32
func (*AddItemRequest) GetUserId ¶
func (x *AddItemRequest) GetUserId() string
func (*AddItemRequest) ProtoMessage ¶
func (*AddItemRequest) ProtoMessage()
func (*AddItemRequest) ProtoReflect ¶
func (x *AddItemRequest) ProtoReflect() protoreflect.Message
func (*AddItemRequest) Reset ¶
func (x *AddItemRequest) Reset()
func (*AddItemRequest) String ¶
func (x *AddItemRequest) String() string
type AddItemResponse ¶
type AddItemResponse struct {
Cart *Cart `protobuf:"bytes,1,opt,name=cart,proto3" json:"cart,omitempty"`
// contains filtered or unexported fields
}
Response after adding an item to the cart.
func (*AddItemResponse) Descriptor
deprecated
func (*AddItemResponse) Descriptor() ([]byte, []int)
Deprecated: Use AddItemResponse.ProtoReflect.Descriptor instead.
func (*AddItemResponse) GetCart ¶
func (x *AddItemResponse) GetCart() *Cart
func (*AddItemResponse) ProtoMessage ¶
func (*AddItemResponse) ProtoMessage()
func (*AddItemResponse) ProtoReflect ¶
func (x *AddItemResponse) ProtoReflect() protoreflect.Message
func (*AddItemResponse) Reset ¶
func (x *AddItemResponse) Reset()
func (*AddItemResponse) String ¶
func (x *AddItemResponse) String() string
type Cart ¶
type Cart struct {
UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`
Items []*CartItem `protobuf:"bytes,2,rep,name=items,proto3" json:"items,omitempty"`
TotalPrice float64 `protobuf:"fixed64,3,opt,name=total_price,json=totalPrice,proto3" json:"total_price,omitempty"`
// contains filtered or unexported fields
}
The Cart message represents a user's shopping session.
func (*Cart) Descriptor
deprecated
func (*Cart) GetTotalPrice ¶
func (*Cart) ProtoMessage ¶
func (*Cart) ProtoMessage()
func (*Cart) ProtoReflect ¶
func (x *Cart) ProtoReflect() protoreflect.Message
type CartItem ¶
type CartItem struct {
ProductId string `protobuf:"bytes,1,opt,name=product_id,json=productId,proto3" json:"product_id,omitempty"`
Quantity int32 `protobuf:"varint,2,opt,name=quantity,proto3" json:"quantity,omitempty"`
LinePrice float64 `protobuf:"fixed64,3,opt,name=line_price,json=linePrice,proto3" json:"line_price,omitempty"`
// contains filtered or unexported fields
}
The CartItem message represents a product in the cart.
func (*CartItem) Descriptor
deprecated
func (*CartItem) GetLinePrice ¶
func (*CartItem) GetProductId ¶
func (*CartItem) GetQuantity ¶
func (*CartItem) ProtoMessage ¶
func (*CartItem) ProtoMessage()
func (*CartItem) ProtoReflect ¶
func (x *CartItem) ProtoReflect() protoreflect.Message
type CartServiceClient ¶
type CartServiceClient interface {
GetCart(ctx context.Context, in *GetCartRequest, opts ...grpc.CallOption) (*GetCartResponse, error)
AddItem(ctx context.Context, in *AddItemRequest, opts ...grpc.CallOption) (*AddItemResponse, error)
RemoveItem(ctx context.Context, in *RemoveItemRequest, opts ...grpc.CallOption) (*RemoveItemResponse, error)
ClearCart(ctx context.Context, in *ClearCartRequest, opts ...grpc.CallOption) (*ClearCartResponse, error)
}
CartServiceClient is the client API for CartService 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.
CartService provides shopping cart operations.
func NewCartServiceClient ¶
func NewCartServiceClient(cc grpc.ClientConnInterface) CartServiceClient
type CartServiceServer ¶
type CartServiceServer interface {
GetCart(context.Context, *GetCartRequest) (*GetCartResponse, error)
AddItem(context.Context, *AddItemRequest) (*AddItemResponse, error)
RemoveItem(context.Context, *RemoveItemRequest) (*RemoveItemResponse, error)
ClearCart(context.Context, *ClearCartRequest) (*ClearCartResponse, error)
// contains filtered or unexported methods
}
CartServiceServer is the server API for CartService service. All implementations must embed UnimplementedCartServiceServer for forward compatibility.
CartService provides shopping cart operations.
type ClearCartRequest ¶
type ClearCartRequest struct {
UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`
// contains filtered or unexported fields
}
Request to clear all items from the cart.
func (*ClearCartRequest) Descriptor
deprecated
func (*ClearCartRequest) Descriptor() ([]byte, []int)
Deprecated: Use ClearCartRequest.ProtoReflect.Descriptor instead.
func (*ClearCartRequest) GetUserId ¶
func (x *ClearCartRequest) GetUserId() string
func (*ClearCartRequest) ProtoMessage ¶
func (*ClearCartRequest) ProtoMessage()
func (*ClearCartRequest) ProtoReflect ¶
func (x *ClearCartRequest) ProtoReflect() protoreflect.Message
func (*ClearCartRequest) Reset ¶
func (x *ClearCartRequest) Reset()
func (*ClearCartRequest) String ¶
func (x *ClearCartRequest) String() string
type ClearCartResponse ¶
type ClearCartResponse struct {
Cart *Cart `protobuf:"bytes,1,opt,name=cart,proto3" json:"cart,omitempty"`
// contains filtered or unexported fields
}
Response after clearing the cart.
func (*ClearCartResponse) Descriptor
deprecated
func (*ClearCartResponse) Descriptor() ([]byte, []int)
Deprecated: Use ClearCartResponse.ProtoReflect.Descriptor instead.
func (*ClearCartResponse) GetCart ¶
func (x *ClearCartResponse) GetCart() *Cart
func (*ClearCartResponse) ProtoMessage ¶
func (*ClearCartResponse) ProtoMessage()
func (*ClearCartResponse) ProtoReflect ¶
func (x *ClearCartResponse) ProtoReflect() protoreflect.Message
func (*ClearCartResponse) Reset ¶
func (x *ClearCartResponse) Reset()
func (*ClearCartResponse) String ¶
func (x *ClearCartResponse) String() string
type GetCartRequest ¶
type GetCartRequest struct {
UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`
// contains filtered or unexported fields
}
Request to get a user's cart.
func (*GetCartRequest) Descriptor
deprecated
func (*GetCartRequest) Descriptor() ([]byte, []int)
Deprecated: Use GetCartRequest.ProtoReflect.Descriptor instead.
func (*GetCartRequest) GetUserId ¶
func (x *GetCartRequest) GetUserId() string
func (*GetCartRequest) ProtoMessage ¶
func (*GetCartRequest) ProtoMessage()
func (*GetCartRequest) ProtoReflect ¶
func (x *GetCartRequest) ProtoReflect() protoreflect.Message
func (*GetCartRequest) Reset ¶
func (x *GetCartRequest) Reset()
func (*GetCartRequest) String ¶
func (x *GetCartRequest) String() string
type GetCartResponse ¶
type GetCartResponse struct {
Cart *Cart `protobuf:"bytes,1,opt,name=cart,proto3" json:"cart,omitempty"`
// contains filtered or unexported fields
}
Response for getting a user's cart.
func (*GetCartResponse) Descriptor
deprecated
func (*GetCartResponse) Descriptor() ([]byte, []int)
Deprecated: Use GetCartResponse.ProtoReflect.Descriptor instead.
func (*GetCartResponse) GetCart ¶
func (x *GetCartResponse) GetCart() *Cart
func (*GetCartResponse) ProtoMessage ¶
func (*GetCartResponse) ProtoMessage()
func (*GetCartResponse) ProtoReflect ¶
func (x *GetCartResponse) ProtoReflect() protoreflect.Message
func (*GetCartResponse) Reset ¶
func (x *GetCartResponse) Reset()
func (*GetCartResponse) String ¶
func (x *GetCartResponse) String() string
type RemoveItemRequest ¶
type RemoveItemRequest struct {
UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`
ProductId string `protobuf:"bytes,2,opt,name=product_id,json=productId,proto3" json:"product_id,omitempty"`
// contains filtered or unexported fields
}
Request to remove an item from the cart.
func (*RemoveItemRequest) Descriptor
deprecated
func (*RemoveItemRequest) Descriptor() ([]byte, []int)
Deprecated: Use RemoveItemRequest.ProtoReflect.Descriptor instead.
func (*RemoveItemRequest) GetProductId ¶
func (x *RemoveItemRequest) GetProductId() string
func (*RemoveItemRequest) GetUserId ¶
func (x *RemoveItemRequest) GetUserId() string
func (*RemoveItemRequest) ProtoMessage ¶
func (*RemoveItemRequest) ProtoMessage()
func (*RemoveItemRequest) ProtoReflect ¶
func (x *RemoveItemRequest) ProtoReflect() protoreflect.Message
func (*RemoveItemRequest) Reset ¶
func (x *RemoveItemRequest) Reset()
func (*RemoveItemRequest) String ¶
func (x *RemoveItemRequest) String() string
type RemoveItemResponse ¶
type RemoveItemResponse struct {
Cart *Cart `protobuf:"bytes,1,opt,name=cart,proto3" json:"cart,omitempty"`
// contains filtered or unexported fields
}
Response after removing an item from the cart.
func (*RemoveItemResponse) Descriptor
deprecated
func (*RemoveItemResponse) Descriptor() ([]byte, []int)
Deprecated: Use RemoveItemResponse.ProtoReflect.Descriptor instead.
func (*RemoveItemResponse) GetCart ¶
func (x *RemoveItemResponse) GetCart() *Cart
func (*RemoveItemResponse) ProtoMessage ¶
func (*RemoveItemResponse) ProtoMessage()
func (*RemoveItemResponse) ProtoReflect ¶
func (x *RemoveItemResponse) ProtoReflect() protoreflect.Message
func (*RemoveItemResponse) Reset ¶
func (x *RemoveItemResponse) Reset()
func (*RemoveItemResponse) String ¶
func (x *RemoveItemResponse) String() string
type UnimplementedCartServiceServer ¶
type UnimplementedCartServiceServer struct{}
UnimplementedCartServiceServer 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.
func (UnimplementedCartServiceServer) AddItem ¶
func (UnimplementedCartServiceServer) AddItem(context.Context, *AddItemRequest) (*AddItemResponse, error)
func (UnimplementedCartServiceServer) ClearCart ¶
func (UnimplementedCartServiceServer) ClearCart(context.Context, *ClearCartRequest) (*ClearCartResponse, error)
func (UnimplementedCartServiceServer) GetCart ¶
func (UnimplementedCartServiceServer) GetCart(context.Context, *GetCartRequest) (*GetCartResponse, error)
func (UnimplementedCartServiceServer) RemoveItem ¶
func (UnimplementedCartServiceServer) RemoveItem(context.Context, *RemoveItemRequest) (*RemoveItemResponse, error)
type UnsafeCartServiceServer ¶
type UnsafeCartServiceServer interface {
// contains filtered or unexported methods
}
UnsafeCartServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to CartServiceServer will result in compilation errors.