shoppingcart

package
v0.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 12, 2021 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_hotitems_proto protoreflect.FileDescriptor
View Source
var File_shoppingcart_proto protoreflect.FileDescriptor

Functions

func NewShoppingCart

func NewShoppingCart(id crdt.EntityID) crdt.EntityHandler

func RegisterHotItemsServiceServer

func RegisterHotItemsServiceServer(s *grpc.Server, srv HotItemsServiceServer)

func RegisterShoppingCartServiceServer

func RegisterShoppingCartServiceServer(s *grpc.Server, 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) Descriptor() ([]byte, []int)

Deprecated: Use Cart.ProtoReflect.Descriptor instead.

func (*Cart) GetItems

func (x *Cart) GetItems() []*LineItem

func (*Cart) ProtoMessage

func (*Cart) ProtoMessage()

func (*Cart) ProtoReflect

func (x *Cart) ProtoReflect() protoreflect.Message

func (*Cart) Reset

func (x *Cart) Reset()

func (*Cart) String

func (x *Cart) String() string

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://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

type HotItemsServiceServer

type HotItemsServiceServer interface {
	ItemAddedToCart(context.Context, *Item) (*empty.Empty, error)
}

HotItemsServiceServer is the server API for HotItemsService service.

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) Descriptor() ([]byte, []int)

Deprecated: Use Item.ProtoReflect.Descriptor instead.

func (*Item) GetName

func (x *Item) GetName() string

func (*Item) GetProductId

func (x *Item) GetProductId() string

func (*Item) GetQuantity

func (x *Item) GetQuantity() int32

func (*Item) ProtoMessage

func (*Item) ProtoMessage()

func (*Item) ProtoReflect

func (x *Item) ProtoReflect() protoreflect.Message

func (*Item) Reset

func (x *Item) Reset()

func (*Item) String

func (x *Item) 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) Descriptor() ([]byte, []int)

Deprecated: Use LineItem.ProtoReflect.Descriptor instead.

func (*LineItem) GetName

func (x *LineItem) GetName() string

func (*LineItem) GetProductId

func (x *LineItem) GetProductId() string

func (*LineItem) GetQuantity

func (x *LineItem) GetQuantity() int32

func (*LineItem) ProtoMessage

func (*LineItem) ProtoMessage()

func (*LineItem) ProtoReflect

func (x *LineItem) ProtoReflect() protoreflect.Message

func (*LineItem) Reset

func (x *LineItem) Reset()

func (*LineItem) String

func (x *LineItem) String() string

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) Default

func (s *ShoppingCart) Default(ctx *crdt.Context) (crdt.CRDT, error)

tag::creation[]

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[]

func (*ShoppingCart) Set

func (s *ShoppingCart) Set(ctx *crdt.Context, state crdt.CRDT) error

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://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

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
}

ShoppingCartServiceServer is the server API for ShoppingCartService service.

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 can be embedded to have forward compatible implementations.

func (*UnimplementedHotItemsServiceServer) ItemAddedToCart

type UnimplementedShoppingCartServiceServer

type UnimplementedShoppingCartServiceServer struct {
}

UnimplementedShoppingCartServiceServer can be embedded to have forward compatible implementations.

func (*UnimplementedShoppingCartServiceServer) AddItem

func (*UnimplementedShoppingCartServiceServer) GetCart

func (*UnimplementedShoppingCartServiceServer) RemoveItem

func (*UnimplementedShoppingCartServiceServer) WatchCart

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL