valueentity

package
v0.3.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
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) 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 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 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 (sc *ShoppingCart) HandleState(ctx *value.Context, state *any.Any) error

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.

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

func (UnimplementedShoppingCartServer) RemoveCart

func (UnimplementedShoppingCartServer) RemoveItem

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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