Documentation
¶
Index ¶
- Variables
- func RegisterDeckServiceServer(s grpc.ServiceRegistrar, srv DeckServiceServer)
- type Card
- type Cards
- type CreateDeckRequest
- func (*CreateDeckRequest) Descriptor() ([]byte, []int)deprecated
- func (x *CreateDeckRequest) GetCodes() []string
- func (x *CreateDeckRequest) GetComp() string
- func (*CreateDeckRequest) ProtoMessage()
- func (x *CreateDeckRequest) ProtoReflect() protoreflect.Message
- func (x *CreateDeckRequest) Reset()
- func (x *CreateDeckRequest) String() string
- type CreateDeckResponse
- type Deck
- func (*Deck) Descriptor() ([]byte, []int)deprecated
- func (x *Deck) GetCards() []*Card
- func (x *Deck) GetId() string
- func (x *Deck) GetRemaining() int32
- func (x *Deck) GetShuffled() bool
- func (*Deck) ProtoMessage()
- func (x *Deck) ProtoReflect() protoreflect.Message
- func (x *Deck) Reset()
- func (x *Deck) String() string
- type DeckService
- func (s *DeckService) CreateDeck(ctx context.Context, req *CreateDeckRequest) (*CreateDeckResponse, error)
- func (s *DeckService) DrawCards(ctx context.Context, req *DrawCardsRequest) (*DrawCardsResponse, error)
- func (s *DeckService) OpenDeck(ctx context.Context, req *OpenDeckRequest) (*OpenDeckResponse, error)
- func (s *DeckService) ShuffleDeck(ctx context.Context, req *ShuffleDeckRequest) (*ShuffleDeckResponse, error)
- type DeckServiceClient
- type DeckServiceServer
- type DrawCardsRequest
- func (*DrawCardsRequest) Descriptor() ([]byte, []int)deprecated
- func (x *DrawCardsRequest) GetId() string
- func (x *DrawCardsRequest) GetNum() int32
- func (*DrawCardsRequest) ProtoMessage()
- func (x *DrawCardsRequest) ProtoReflect() protoreflect.Message
- func (x *DrawCardsRequest) Reset()
- func (x *DrawCardsRequest) String() string
- type DrawCardsResponse
- type OpenDeckRequest
- type OpenDeckResponse
- type Server
- type ShuffleDeckRequest
- type ShuffleDeckResponse
- func (*ShuffleDeckResponse) Descriptor() ([]byte, []int)deprecated
- func (x *ShuffleDeckResponse) GetMessage() string
- func (*ShuffleDeckResponse) ProtoMessage()
- func (x *ShuffleDeckResponse) ProtoReflect() protoreflect.Message
- func (x *ShuffleDeckResponse) Reset()
- func (x *ShuffleDeckResponse) String() string
- type UnimplementedDeckServiceServer
- func (UnimplementedDeckServiceServer) CreateDeck(context.Context, *CreateDeckRequest) (*CreateDeckResponse, error)
- func (UnimplementedDeckServiceServer) DrawCards(context.Context, *DrawCardsRequest) (*DrawCardsResponse, error)
- func (UnimplementedDeckServiceServer) OpenDeck(context.Context, *OpenDeckRequest) (*OpenDeckResponse, error)
- func (UnimplementedDeckServiceServer) ShuffleDeck(context.Context, *ShuffleDeckRequest) (*ShuffleDeckResponse, error)
- type UnsafeDeckServiceServer
Constants ¶
This section is empty.
Variables ¶
var DeckService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "grpc.DeckService", HandlerType: (*DeckServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "CreateDeck", Handler: _DeckService_CreateDeck_Handler, }, { MethodName: "OpenDeck", Handler: _DeckService_OpenDeck_Handler, }, { MethodName: "DrawCards", Handler: _DeckService_DrawCards_Handler, }, { MethodName: "ShuffleDeck", Handler: _DeckService_ShuffleDeck_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "grpc/deck_service.proto", }
DeckService_ServiceDesc is the grpc.ServiceDesc for DeckService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
var File_grpc_deck_proto protoreflect.FileDescriptor
var File_grpc_deck_service_proto protoreflect.FileDescriptor
Functions ¶
func RegisterDeckServiceServer ¶
func RegisterDeckServiceServer(s grpc.ServiceRegistrar, srv DeckServiceServer)
Types ¶
type Card ¶
type Card struct { Value string `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` Suit string `protobuf:"bytes,2,opt,name=suit,proto3" json:"suit,omitempty"` Code string `protobuf:"bytes,3,opt,name=code,proto3" json:"code,omitempty"` // contains filtered or unexported fields }
Card represents a single card.
func (*Card) Descriptor
deprecated
func (*Card) ProtoMessage ¶
func (*Card) ProtoMessage()
func (*Card) ProtoReflect ¶
func (x *Card) ProtoReflect() protoreflect.Message
type Cards ¶
type Cards struct { Cards []*Card `protobuf:"bytes,1,rep,name=cards,proto3" json:"cards,omitempty"` // contains filtered or unexported fields }
Cards represents a collection of cards.
func DomainCardsToCards ¶
DomainCardsToCards transforms domain cards to Cards.
func (*Cards) Descriptor
deprecated
func (*Cards) ProtoMessage ¶
func (*Cards) ProtoMessage()
func (*Cards) ProtoReflect ¶
func (x *Cards) ProtoReflect() protoreflect.Message
type CreateDeckRequest ¶
type CreateDeckRequest struct { Comp *string `protobuf:"bytes,1,opt,name=comp,proto3,oneof" json:"comp,omitempty"` Codes []string `protobuf:"bytes,2,rep,name=codes,proto3" json:"codes,omitempty"` // contains filtered or unexported fields }
CreateDeckRequest holds the composition and optional codes needed to create a deck.
func (*CreateDeckRequest) Descriptor
deprecated
func (*CreateDeckRequest) Descriptor() ([]byte, []int)
Deprecated: Use CreateDeckRequest.ProtoReflect.Descriptor instead.
func (*CreateDeckRequest) GetCodes ¶
func (x *CreateDeckRequest) GetCodes() []string
func (*CreateDeckRequest) GetComp ¶
func (x *CreateDeckRequest) GetComp() string
func (*CreateDeckRequest) ProtoMessage ¶
func (*CreateDeckRequest) ProtoMessage()
func (*CreateDeckRequest) ProtoReflect ¶
func (x *CreateDeckRequest) ProtoReflect() protoreflect.Message
func (*CreateDeckRequest) Reset ¶
func (x *CreateDeckRequest) Reset()
func (*CreateDeckRequest) String ¶
func (x *CreateDeckRequest) String() string
type CreateDeckResponse ¶
type CreateDeckResponse struct { Deck *Deck `protobuf:"bytes,1,opt,name=deck,proto3" json:"deck,omitempty"` // contains filtered or unexported fields }
CreateDeckResponse holds the deck created.
func (*CreateDeckResponse) Descriptor
deprecated
func (*CreateDeckResponse) Descriptor() ([]byte, []int)
Deprecated: Use CreateDeckResponse.ProtoReflect.Descriptor instead.
func (*CreateDeckResponse) GetDeck ¶
func (x *CreateDeckResponse) GetDeck() *Deck
func (*CreateDeckResponse) ProtoMessage ¶
func (*CreateDeckResponse) ProtoMessage()
func (*CreateDeckResponse) ProtoReflect ¶
func (x *CreateDeckResponse) ProtoReflect() protoreflect.Message
func (*CreateDeckResponse) Reset ¶
func (x *CreateDeckResponse) Reset()
func (*CreateDeckResponse) String ¶
func (x *CreateDeckResponse) String() string
type Deck ¶
type Deck struct { Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` Shuffled bool `protobuf:"varint,2,opt,name=shuffled,proto3" json:"shuffled,omitempty"` Remaining int32 `protobuf:"varint,3,opt,name=remaining,proto3" json:"remaining,omitempty"` Cards []*Card `protobuf:"bytes,4,rep,name=cards,proto3" json:"cards,omitempty"` // contains filtered or unexported fields }
Deck represents a opened deck of cards.
func DomainDeckToDeck ¶
DomainDeckToDeck transforms a domain deck to a DeckClosed.
func (*Deck) Descriptor
deprecated
func (*Deck) GetRemaining ¶
func (*Deck) GetShuffled ¶
func (*Deck) ProtoMessage ¶
func (*Deck) ProtoMessage()
func (*Deck) ProtoReflect ¶
func (x *Deck) ProtoReflect() protoreflect.Message
type DeckService ¶
type DeckService struct { UnimplementedDeckServiceServer // contains filtered or unexported fields }
DeckService is a grpc deck service.
func NewDeckService ¶
func NewDeckService(log *logger.Logger, repo repo.Repository) *DeckService
NewDeckService creates a new DeckService.
func (*DeckService) CreateDeck ¶
func (s *DeckService) CreateDeck(ctx context.Context, req *CreateDeckRequest) (*CreateDeckResponse, error)
CreateDeck creates a new full or partial deck of cards given an optional list of codes.
func (*DeckService) DrawCards ¶
func (s *DeckService) DrawCards(ctx context.Context, req *DrawCardsRequest) (*DrawCardsResponse, error)
DrawCards draws cards from a deck of cards given an id and the number of cards.
func (*DeckService) OpenDeck ¶
func (s *DeckService) OpenDeck(ctx context.Context, req *OpenDeckRequest) (*OpenDeckResponse, error)
OpenDeck opens a deck of cards given an id.
func (*DeckService) ShuffleDeck ¶
func (s *DeckService) ShuffleDeck(ctx context.Context, req *ShuffleDeckRequest) (*ShuffleDeckResponse, error)
ShuffleDeck shuffles a deck of cards given an id.
type DeckServiceClient ¶
type DeckServiceClient interface { // CreateDeck creates a new full or partial deck of cards given an optional // list of codes. CreateDeck(ctx context.Context, in *CreateDeckRequest, opts ...grpc.CallOption) (*CreateDeckResponse, error) // OpenDeck opens a deck of cards given an id. OpenDeck(ctx context.Context, in *OpenDeckRequest, opts ...grpc.CallOption) (*OpenDeckResponse, error) // DrawCards draws cards from a deck of cards given an id and the number of // cards. DrawCards(ctx context.Context, in *DrawCardsRequest, opts ...grpc.CallOption) (*DrawCardsResponse, error) // ShuffleDeck shuffles a deck of cards given an id. ShuffleDeck(ctx context.Context, in *ShuffleDeckRequest, opts ...grpc.CallOption) (*ShuffleDeckResponse, error) }
DeckServiceClient is the client API for DeckService 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 NewDeckServiceClient ¶
func NewDeckServiceClient(cc grpc.ClientConnInterface) DeckServiceClient
type DeckServiceServer ¶
type DeckServiceServer interface { // CreateDeck creates a new full or partial deck of cards given an optional // list of codes. CreateDeck(context.Context, *CreateDeckRequest) (*CreateDeckResponse, error) // OpenDeck opens a deck of cards given an id. OpenDeck(context.Context, *OpenDeckRequest) (*OpenDeckResponse, error) // DrawCards draws cards from a deck of cards given an id and the number of // cards. DrawCards(context.Context, *DrawCardsRequest) (*DrawCardsResponse, error) // ShuffleDeck shuffles a deck of cards given an id. ShuffleDeck(context.Context, *ShuffleDeckRequest) (*ShuffleDeckResponse, error) // contains filtered or unexported methods }
DeckServiceServer is the server API for DeckService service. All implementations must embed UnimplementedDeckServiceServer for forward compatibility
type DrawCardsRequest ¶
type DrawCardsRequest struct { Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` Num int32 `protobuf:"varint,2,opt,name=num,proto3" json:"num,omitempty"` // contains filtered or unexported fields }
DrawCardsRequest holds the id of the deck and number of cards to draw from the deck.
func (*DrawCardsRequest) Descriptor
deprecated
func (*DrawCardsRequest) Descriptor() ([]byte, []int)
Deprecated: Use DrawCardsRequest.ProtoReflect.Descriptor instead.
func (*DrawCardsRequest) GetId ¶
func (x *DrawCardsRequest) GetId() string
func (*DrawCardsRequest) GetNum ¶
func (x *DrawCardsRequest) GetNum() int32
func (*DrawCardsRequest) ProtoMessage ¶
func (*DrawCardsRequest) ProtoMessage()
func (*DrawCardsRequest) ProtoReflect ¶
func (x *DrawCardsRequest) ProtoReflect() protoreflect.Message
func (*DrawCardsRequest) Reset ¶
func (x *DrawCardsRequest) Reset()
func (*DrawCardsRequest) String ¶
func (x *DrawCardsRequest) String() string
type DrawCardsResponse ¶
type DrawCardsResponse struct { Cards []*Card `protobuf:"bytes,1,rep,name=cards,proto3" json:"cards,omitempty"` // contains filtered or unexported fields }
DrawCardsResponse holds the cards drawn.
func (*DrawCardsResponse) Descriptor
deprecated
func (*DrawCardsResponse) Descriptor() ([]byte, []int)
Deprecated: Use DrawCardsResponse.ProtoReflect.Descriptor instead.
func (*DrawCardsResponse) GetCards ¶
func (x *DrawCardsResponse) GetCards() []*Card
func (*DrawCardsResponse) ProtoMessage ¶
func (*DrawCardsResponse) ProtoMessage()
func (*DrawCardsResponse) ProtoReflect ¶
func (x *DrawCardsResponse) ProtoReflect() protoreflect.Message
func (*DrawCardsResponse) Reset ¶
func (x *DrawCardsResponse) Reset()
func (*DrawCardsResponse) String ¶
func (x *DrawCardsResponse) String() string
type OpenDeckRequest ¶
type OpenDeckRequest struct { Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // contains filtered or unexported fields }
OpenDeckRequest holds the deck id needed to open a deck.
func (*OpenDeckRequest) Descriptor
deprecated
func (*OpenDeckRequest) Descriptor() ([]byte, []int)
Deprecated: Use OpenDeckRequest.ProtoReflect.Descriptor instead.
func (*OpenDeckRequest) GetId ¶
func (x *OpenDeckRequest) GetId() string
func (*OpenDeckRequest) ProtoMessage ¶
func (*OpenDeckRequest) ProtoMessage()
func (*OpenDeckRequest) ProtoReflect ¶
func (x *OpenDeckRequest) ProtoReflect() protoreflect.Message
func (*OpenDeckRequest) Reset ¶
func (x *OpenDeckRequest) Reset()
func (*OpenDeckRequest) String ¶
func (x *OpenDeckRequest) String() string
type OpenDeckResponse ¶
type OpenDeckResponse struct { Deck *Deck `protobuf:"bytes,1,opt,name=deck,proto3" json:"deck,omitempty"` // contains filtered or unexported fields }
OpenDeckResponse holds the deck opened.
func (*OpenDeckResponse) Descriptor
deprecated
func (*OpenDeckResponse) Descriptor() ([]byte, []int)
Deprecated: Use OpenDeckResponse.ProtoReflect.Descriptor instead.
func (*OpenDeckResponse) GetDeck ¶
func (x *OpenDeckResponse) GetDeck() *Deck
func (*OpenDeckResponse) ProtoMessage ¶
func (*OpenDeckResponse) ProtoMessage()
func (*OpenDeckResponse) ProtoReflect ¶
func (x *OpenDeckResponse) ProtoReflect() protoreflect.Message
func (*OpenDeckResponse) Reset ¶
func (x *OpenDeckResponse) Reset()
func (*OpenDeckResponse) String ¶
func (x *OpenDeckResponse) String() string
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is a grpc server.
type ShuffleDeckRequest ¶
type ShuffleDeckRequest struct { Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // contains filtered or unexported fields }
ShuffleDeckRequest holds the id of the deck to shuffle.
func (*ShuffleDeckRequest) Descriptor
deprecated
func (*ShuffleDeckRequest) Descriptor() ([]byte, []int)
Deprecated: Use ShuffleDeckRequest.ProtoReflect.Descriptor instead.
func (*ShuffleDeckRequest) GetId ¶
func (x *ShuffleDeckRequest) GetId() string
func (*ShuffleDeckRequest) ProtoMessage ¶
func (*ShuffleDeckRequest) ProtoMessage()
func (*ShuffleDeckRequest) ProtoReflect ¶
func (x *ShuffleDeckRequest) ProtoReflect() protoreflect.Message
func (*ShuffleDeckRequest) Reset ¶
func (x *ShuffleDeckRequest) Reset()
func (*ShuffleDeckRequest) String ¶
func (x *ShuffleDeckRequest) String() string
type ShuffleDeckResponse ¶
type ShuffleDeckResponse struct { Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` // contains filtered or unexported fields }
ShuffleDeckResponse holds the message after shuffling a deck.
func (*ShuffleDeckResponse) Descriptor
deprecated
func (*ShuffleDeckResponse) Descriptor() ([]byte, []int)
Deprecated: Use ShuffleDeckResponse.ProtoReflect.Descriptor instead.
func (*ShuffleDeckResponse) GetMessage ¶
func (x *ShuffleDeckResponse) GetMessage() string
func (*ShuffleDeckResponse) ProtoMessage ¶
func (*ShuffleDeckResponse) ProtoMessage()
func (*ShuffleDeckResponse) ProtoReflect ¶
func (x *ShuffleDeckResponse) ProtoReflect() protoreflect.Message
func (*ShuffleDeckResponse) Reset ¶
func (x *ShuffleDeckResponse) Reset()
func (*ShuffleDeckResponse) String ¶
func (x *ShuffleDeckResponse) String() string
type UnimplementedDeckServiceServer ¶
type UnimplementedDeckServiceServer struct { }
UnimplementedDeckServiceServer must be embedded to have forward compatible implementations.
func (UnimplementedDeckServiceServer) CreateDeck ¶
func (UnimplementedDeckServiceServer) CreateDeck(context.Context, *CreateDeckRequest) (*CreateDeckResponse, error)
func (UnimplementedDeckServiceServer) DrawCards ¶
func (UnimplementedDeckServiceServer) DrawCards(context.Context, *DrawCardsRequest) (*DrawCardsResponse, error)
func (UnimplementedDeckServiceServer) OpenDeck ¶
func (UnimplementedDeckServiceServer) OpenDeck(context.Context, *OpenDeckRequest) (*OpenDeckResponse, error)
func (UnimplementedDeckServiceServer) ShuffleDeck ¶
func (UnimplementedDeckServiceServer) ShuffleDeck(context.Context, *ShuffleDeckRequest) (*ShuffleDeckResponse, error)
type UnsafeDeckServiceServer ¶
type UnsafeDeckServiceServer interface {
// contains filtered or unexported methods
}
UnsafeDeckServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to DeckServiceServer will result in compilation errors.