Documentation ¶
Index ¶
- Variables
- func NewShoppingCart(value.EntityID) value.EntityHandler
- func RegisterShoppingCartServer(s grpc.ServiceRegistrar, srv ShoppingCartServer)
- type AddLineItem
- func (*AddLineItem) Descriptor() ([]byte, []int)deprecated
- func (x *AddLineItem) GetName() string
- func (x *AddLineItem) GetProductId() string
- func (x *AddLineItem) GetQuantity() int32
- func (x *AddLineItem) GetUserId() string
- func (*AddLineItem) ProtoMessage()
- func (x *AddLineItem) ProtoReflect() protoreflect.Message
- func (x *AddLineItem) Reset()
- func (x *AddLineItem) String() string
- type Cart
- type GetShoppingCart
- type LineItem
- func (*LineItem) Descriptor() ([]byte, []int)deprecated
- func (x *LineItem) GetName() string
- func (x *LineItem) GetProductId() string
- func (x *LineItem) GetQuantity() int32
- func (*LineItem) ProtoMessage()
- func (x *LineItem) ProtoReflect() protoreflect.Message
- func (x *LineItem) Reset()
- func (x *LineItem) String() string
- type RemoveLineItem
- func (*RemoveLineItem) Descriptor() ([]byte, []int)deprecated
- func (x *RemoveLineItem) GetProductId() string
- func (x *RemoveLineItem) GetUserId() string
- func (*RemoveLineItem) ProtoMessage()
- func (x *RemoveLineItem) ProtoReflect() protoreflect.Message
- func (x *RemoveLineItem) Reset()
- func (x *RemoveLineItem) String() string
- type RemoveShoppingCart
- func (*RemoveShoppingCart) Descriptor() ([]byte, []int)deprecated
- func (x *RemoveShoppingCart) GetUserId() string
- func (*RemoveShoppingCart) ProtoMessage()
- func (x *RemoveShoppingCart) ProtoReflect() protoreflect.Message
- func (x *RemoveShoppingCart) Reset()
- func (x *RemoveShoppingCart) String() string
- type ShoppingCart
- func (sc *ShoppingCart) AddItem(ctx *value.Context, item *AddLineItem) (*any.Any, error)
- func (sc *ShoppingCart) GetCart(*value.Context, *GetShoppingCart) (*any.Any, error)
- func (sc *ShoppingCart) HandleCommand(ctx *value.Context, name string, cmd proto.Message) (*any.Any, error)
- func (sc *ShoppingCart) HandleState(ctx *value.Context, state *any.Any) error
- func (sc *ShoppingCart) RemoveItem(ctx *value.Context, item *RemoveLineItem) (*any.Any, error)
- type ShoppingCartClient
- type ShoppingCartServer
- type UnimplementedShoppingCartServer
- func (UnimplementedShoppingCartServer) AddItem(context.Context, *AddLineItem) (*empty.Empty, error)
- func (UnimplementedShoppingCartServer) GetCart(context.Context, *GetShoppingCart) (*Cart, error)
- func (UnimplementedShoppingCartServer) RemoveCart(context.Context, *RemoveShoppingCart) (*empty.Empty, error)
- func (UnimplementedShoppingCartServer) RemoveItem(context.Context, *RemoveLineItem) (*empty.Empty, error)
- type UnsafeShoppingCartServer
Constants ¶
This section is empty.
Variables ¶
var File_value_shoppingcart_proto protoreflect.FileDescriptor
Functions ¶
func NewShoppingCart ¶
func NewShoppingCart(value.EntityID) value.EntityHandler
NewShoppingCart returns a new and initialized instance of the ShoppingCart entity.
func RegisterShoppingCartServer ¶
func RegisterShoppingCartServer(s grpc.ServiceRegistrar, srv ShoppingCartServer)
Types ¶
type AddLineItem ¶
type AddLineItem 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"` Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` Quantity int32 `protobuf:"varint,4,opt,name=quantity,proto3" json:"quantity,omitempty"` // contains filtered or unexported fields }
func (*AddLineItem) Descriptor
deprecated
func (*AddLineItem) Descriptor() ([]byte, []int)
Deprecated: Use AddLineItem.ProtoReflect.Descriptor instead.
func (*AddLineItem) GetName ¶
func (x *AddLineItem) GetName() string
func (*AddLineItem) GetProductId ¶
func (x *AddLineItem) GetProductId() string
func (*AddLineItem) GetQuantity ¶
func (x *AddLineItem) GetQuantity() int32
func (*AddLineItem) GetUserId ¶
func (x *AddLineItem) GetUserId() string
func (*AddLineItem) ProtoMessage ¶
func (*AddLineItem) ProtoMessage()
func (*AddLineItem) ProtoReflect ¶
func (x *AddLineItem) ProtoReflect() protoreflect.Message
func (*AddLineItem) Reset ¶
func (x *AddLineItem) Reset()
func (*AddLineItem) String ¶
func (x *AddLineItem) String() string
type Cart ¶
type Cart struct { Items []*LineItem `protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty"` // contains filtered or unexported fields }
func (*Cart) Descriptor
deprecated
func (*Cart) ProtoMessage ¶
func (*Cart) ProtoMessage()
func (*Cart) ProtoReflect ¶
func (x *Cart) ProtoReflect() protoreflect.Message
type GetShoppingCart ¶
type GetShoppingCart struct { UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` // contains filtered or unexported fields }
func (*GetShoppingCart) Descriptor
deprecated
func (*GetShoppingCart) Descriptor() ([]byte, []int)
Deprecated: Use GetShoppingCart.ProtoReflect.Descriptor instead.
func (*GetShoppingCart) GetUserId ¶
func (x *GetShoppingCart) GetUserId() string
func (*GetShoppingCart) ProtoMessage ¶
func (*GetShoppingCart) ProtoMessage()
func (*GetShoppingCart) ProtoReflect ¶
func (x *GetShoppingCart) ProtoReflect() protoreflect.Message
func (*GetShoppingCart) Reset ¶
func (x *GetShoppingCart) Reset()
func (*GetShoppingCart) String ¶
func (x *GetShoppingCart) String() string
type LineItem ¶
type LineItem struct { ProductId string `protobuf:"bytes,1,opt,name=product_id,json=productId,proto3" json:"product_id,omitempty"` Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` Quantity int32 `protobuf:"varint,3,opt,name=quantity,proto3" json:"quantity,omitempty"` // contains filtered or unexported fields }
func (*LineItem) Descriptor
deprecated
func (*LineItem) GetProductId ¶
func (*LineItem) GetQuantity ¶
func (*LineItem) ProtoMessage ¶
func (*LineItem) ProtoMessage()
func (*LineItem) ProtoReflect ¶
func (x *LineItem) ProtoReflect() protoreflect.Message
type RemoveLineItem ¶
type RemoveLineItem 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 }
func (*RemoveLineItem) Descriptor
deprecated
func (*RemoveLineItem) Descriptor() ([]byte, []int)
Deprecated: Use RemoveLineItem.ProtoReflect.Descriptor instead.
func (*RemoveLineItem) GetProductId ¶
func (x *RemoveLineItem) GetProductId() string
func (*RemoveLineItem) GetUserId ¶
func (x *RemoveLineItem) GetUserId() string
func (*RemoveLineItem) ProtoMessage ¶
func (*RemoveLineItem) ProtoMessage()
func (*RemoveLineItem) ProtoReflect ¶
func (x *RemoveLineItem) ProtoReflect() protoreflect.Message
func (*RemoveLineItem) Reset ¶
func (x *RemoveLineItem) Reset()
func (*RemoveLineItem) String ¶
func (x *RemoveLineItem) String() string
type RemoveShoppingCart ¶
type RemoveShoppingCart struct { UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` // contains filtered or unexported fields }
func (*RemoveShoppingCart) Descriptor
deprecated
func (*RemoveShoppingCart) Descriptor() ([]byte, []int)
Deprecated: Use RemoveShoppingCart.ProtoReflect.Descriptor instead.
func (*RemoveShoppingCart) GetUserId ¶
func (x *RemoveShoppingCart) GetUserId() string
func (*RemoveShoppingCart) ProtoMessage ¶
func (*RemoveShoppingCart) ProtoMessage()
func (*RemoveShoppingCart) ProtoReflect ¶
func (x *RemoveShoppingCart) ProtoReflect() protoreflect.Message
func (*RemoveShoppingCart) Reset ¶
func (x *RemoveShoppingCart) Reset()
func (*RemoveShoppingCart) String ¶
func (x *RemoveShoppingCart) String() string
type ShoppingCart ¶
type ShoppingCart struct {
// contains filtered or unexported fields
}
A Cloudstate event sourced entity implementing a shopping cart.
func (*ShoppingCart) AddItem ¶
func (sc *ShoppingCart) AddItem(ctx *value.Context, item *AddLineItem) (*any.Any, error)
AddItem implements the AddItem command handling of the shopping cart service.
func (*ShoppingCart) GetCart ¶
func (sc *ShoppingCart) GetCart(*value.Context, *GetShoppingCart) (*any.Any, error)
GetCart implements the GetCart command handling of the shopping cart service.
func (*ShoppingCart) HandleCommand ¶
func (sc *ShoppingCart) HandleCommand(ctx *value.Context, name string, cmd proto.Message) (*any.Any, error)
HandleCommand is the entities command handler implemented by the shopping cart.
func (*ShoppingCart) HandleState ¶
func (*ShoppingCart) RemoveItem ¶
func (sc *ShoppingCart) RemoveItem(ctx *value.Context, item *RemoveLineItem) (*any.Any, error)
RemoveItem implements the RemoveItem command handling of the shopping cart service.
type ShoppingCartClient ¶
type ShoppingCartClient interface { AddItem(ctx context.Context, in *AddLineItem, opts ...grpc.CallOption) (*empty.Empty, error) RemoveItem(ctx context.Context, in *RemoveLineItem, opts ...grpc.CallOption) (*empty.Empty, error) GetCart(ctx context.Context, in *GetShoppingCart, opts ...grpc.CallOption) (*Cart, error) RemoveCart(ctx context.Context, in *RemoveShoppingCart, opts ...grpc.CallOption) (*empty.Empty, error) }
ShoppingCartClient is the client API for ShoppingCart 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.
func NewShoppingCartClient ¶
func NewShoppingCartClient(cc grpc.ClientConnInterface) ShoppingCartClient
type ShoppingCartServer ¶
type ShoppingCartServer interface { AddItem(context.Context, *AddLineItem) (*empty.Empty, error) RemoveItem(context.Context, *RemoveLineItem) (*empty.Empty, error) GetCart(context.Context, *GetShoppingCart) (*Cart, error) RemoveCart(context.Context, *RemoveShoppingCart) (*empty.Empty, error) // contains filtered or unexported methods }
ShoppingCartServer is the server API for ShoppingCart service. All implementations must embed UnimplementedShoppingCartServer for forward compatibility
type UnimplementedShoppingCartServer ¶
type UnimplementedShoppingCartServer struct { }
UnimplementedShoppingCartServer must be embedded to have forward compatible implementations.
func (UnimplementedShoppingCartServer) AddItem ¶
func (UnimplementedShoppingCartServer) AddItem(context.Context, *AddLineItem) (*empty.Empty, error)
func (UnimplementedShoppingCartServer) GetCart ¶
func (UnimplementedShoppingCartServer) GetCart(context.Context, *GetShoppingCart) (*Cart, error)
func (UnimplementedShoppingCartServer) RemoveCart ¶
func (UnimplementedShoppingCartServer) RemoveCart(context.Context, *RemoveShoppingCart) (*empty.Empty, error)
func (UnimplementedShoppingCartServer) RemoveItem ¶
func (UnimplementedShoppingCartServer) RemoveItem(context.Context, *RemoveLineItem) (*empty.Empty, error)
type UnsafeShoppingCartServer ¶
type UnsafeShoppingCartServer interface {
// contains filtered or unexported methods
}
UnsafeShoppingCartServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to ShoppingCartServer will result in compilation errors.