Documentation
¶
Index ¶
- Variables
- func NewShoppingCart(id crdt.EntityID) crdt.EntityHandler
- func RegisterHotItemsServiceServer(s grpc.ServiceRegistrar, srv HotItemsServiceServer)
- func RegisterShoppingCartServiceServer(s grpc.ServiceRegistrar, srv ShoppingCartServiceServer)
- 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 HotItemsServiceClient
- type HotItemsServiceServer
- type Item
- 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 ShoppingCart
- type ShoppingCartServiceClient
- type ShoppingCartServiceServer
- type ShoppingCartService_WatchCartClient
- type ShoppingCartService_WatchCartServer
- type UnimplementedHotItemsServiceServer
- type UnimplementedShoppingCartServiceServer
- func (UnimplementedShoppingCartServiceServer) AddItem(context.Context, *AddLineItem) (*empty.Empty, error)
- func (UnimplementedShoppingCartServiceServer) GetCart(context.Context, *GetShoppingCart) (*Cart, error)
- func (UnimplementedShoppingCartServiceServer) RemoveItem(context.Context, *RemoveLineItem) (*empty.Empty, error)
- func (UnimplementedShoppingCartServiceServer) WatchCart(*GetShoppingCart, ShoppingCartService_WatchCartServer) error
- type UnsafeHotItemsServiceServer
- type UnsafeShoppingCartServiceServer
Constants ¶
This section is empty.
Variables ¶
var File_hotitems_proto protoreflect.FileDescriptor
var File_shoppingcart_proto protoreflect.FileDescriptor
Functions ¶
func NewShoppingCart ¶
func NewShoppingCart(id crdt.EntityID) crdt.EntityHandler
func RegisterHotItemsServiceServer ¶
func RegisterHotItemsServiceServer(s grpc.ServiceRegistrar, srv HotItemsServiceServer)
func RegisterShoppingCartServiceServer ¶
func RegisterShoppingCartServiceServer(s grpc.ServiceRegistrar, srv ShoppingCartServiceServer)
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 HotItemsServiceClient ¶
type HotItemsServiceClient interface {
ItemAddedToCart(ctx context.Context, in *Item, opts ...grpc.CallOption) (*empty.Empty, error)
}
HotItemsServiceClient is the client API for HotItemsService 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 NewHotItemsServiceClient ¶
func NewHotItemsServiceClient(cc grpc.ClientConnInterface) HotItemsServiceClient
type HotItemsServiceServer ¶
type HotItemsServiceServer interface { ItemAddedToCart(context.Context, *Item) (*empty.Empty, error) // contains filtered or unexported methods }
HotItemsServiceServer is the server API for HotItemsService service. All implementations must embed UnimplementedHotItemsServiceServer for forward compatibility
type Item ¶
type Item 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 (*Item) Descriptor
deprecated
func (*Item) GetProductId ¶
func (*Item) GetQuantity ¶
func (*Item) ProtoMessage ¶
func (*Item) ProtoMessage()
func (*Item) ProtoReflect ¶
func (x *Item) ProtoReflect() protoreflect.Message
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 ShoppingCart ¶
type ShoppingCart struct {
// contains filtered or unexported fields
}
func (*ShoppingCart) HandleCommand ¶
func (s *ShoppingCart) HandleCommand(ctx *crdt.CommandContext, name string, msg proto.Message) (*any.Any, error)
tag::command-handling-getcart-0[] tag::add-item-0[]
type ShoppingCartServiceClient ¶
type ShoppingCartServiceClient 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) WatchCart(ctx context.Context, in *GetShoppingCart, opts ...grpc.CallOption) (ShoppingCartService_WatchCartClient, error) }
ShoppingCartServiceClient is the client API for ShoppingCartService 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 NewShoppingCartServiceClient ¶
func NewShoppingCartServiceClient(cc grpc.ClientConnInterface) ShoppingCartServiceClient
type ShoppingCartServiceServer ¶
type ShoppingCartServiceServer interface { AddItem(context.Context, *AddLineItem) (*empty.Empty, error) RemoveItem(context.Context, *RemoveLineItem) (*empty.Empty, error) GetCart(context.Context, *GetShoppingCart) (*Cart, error) WatchCart(*GetShoppingCart, ShoppingCartService_WatchCartServer) error // contains filtered or unexported methods }
ShoppingCartServiceServer is the server API for ShoppingCartService service. All implementations must embed UnimplementedShoppingCartServiceServer for forward compatibility
type ShoppingCartService_WatchCartClient ¶
type ShoppingCartService_WatchCartClient interface { Recv() (*Cart, error) grpc.ClientStream }
type ShoppingCartService_WatchCartServer ¶
type ShoppingCartService_WatchCartServer interface { Send(*Cart) error grpc.ServerStream }
type UnimplementedHotItemsServiceServer ¶
type UnimplementedHotItemsServiceServer struct { }
UnimplementedHotItemsServiceServer must be embedded to have forward compatible implementations.
func (UnimplementedHotItemsServiceServer) ItemAddedToCart ¶
type UnimplementedShoppingCartServiceServer ¶
type UnimplementedShoppingCartServiceServer struct { }
UnimplementedShoppingCartServiceServer must be embedded to have forward compatible implementations.
func (UnimplementedShoppingCartServiceServer) AddItem ¶
func (UnimplementedShoppingCartServiceServer) AddItem(context.Context, *AddLineItem) (*empty.Empty, error)
func (UnimplementedShoppingCartServiceServer) GetCart ¶
func (UnimplementedShoppingCartServiceServer) GetCart(context.Context, *GetShoppingCart) (*Cart, error)
func (UnimplementedShoppingCartServiceServer) RemoveItem ¶
func (UnimplementedShoppingCartServiceServer) RemoveItem(context.Context, *RemoveLineItem) (*empty.Empty, error)
type UnsafeHotItemsServiceServer ¶ added in v0.3.0
type UnsafeHotItemsServiceServer interface {
// contains filtered or unexported methods
}
UnsafeHotItemsServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to HotItemsServiceServer will result in compilation errors.
type UnsafeShoppingCartServiceServer ¶ added in v0.3.0
type UnsafeShoppingCartServiceServer interface {
// contains filtered or unexported methods
}
UnsafeShoppingCartServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to ShoppingCartServiceServer will result in compilation errors.