Documentation ¶
Index ¶
- Constants
- Variables
- type Auth
- type AuthConfig
- type Clock
- type Game
- type GameStorage
- type NewGameInput
- type NewGameOutput
- type NewQuestionInput
- type NewQuestionOutput
- type Question
- type QuestionStorage
- type Scenario
- type Service
- type ServiceConfig
- type SubmitAnswerInput
- type SubmitAnswerOutput
- type TimedQuestion
- type TimeoutCalculator
Constants ¶
View Source
const ( ScenarioNewQuestion = "NEW_QUESTION" ScenarioSubmitAnswer = "SUBMIT_ANSWER" ScenarioGameOver = "GAME_OVER" )
Variables ¶
Functions ¶
This section is empty.
Types ¶
type AuthConfig ¶
type AuthConfig struct {
APIKey string `validate:"nonzero"`
}
func (AuthConfig) Validate ¶
func (c AuthConfig) Validate() error
type GameStorage ¶
type GameStorage interface { // PutGame is used for putting the game instance on storage. If game is already // exists on storage, it will be overwritten. PutGame(ctx context.Context, g Game) error // GetGame returns game instance stored on storage. Returns nil when game is not // found on storage. GetGame(ctx context.Context, gameID string) (*Game, error) }
type NewGameInput ¶
type NewGameInput struct {
PlayerName string `validate:"nonzero"`
}
func (NewGameInput) Validate ¶
func (i NewGameInput) Validate() error
type NewGameOutput ¶
type NewQuestionInput ¶
type NewQuestionInput struct {
GameID string `validate:"nonzero"`
}
func (NewQuestionInput) Validate ¶
func (i NewQuestionInput) Validate() error
type NewQuestionOutput ¶
type QuestionStorage ¶
type Service ¶
type Service interface { NewGame(ctx context.Context, input NewGameInput) (*NewGameOutput, error) NewQuestion(ctx context.Context, input NewQuestionInput) (*NewQuestionOutput, error) SubmitAnswer(ctx context.Context, input SubmitAnswerInput) (*SubmitAnswerOutput, error) }
func NewService ¶
func NewService(cfg ServiceConfig) (Service, error)
type ServiceConfig ¶
type ServiceConfig struct { GameStorage GameStorage `validate:"nonnil"` QuestionStorage QuestionStorage `validate:"nonnil"` TimeoutCalculator TimeoutCalculator `validate:"nonnil"` Clock Clock `validate:"nonnil"` AddScore int `validate:"min=1"` }
func (ServiceConfig) Validate ¶
func (c ServiceConfig) Validate() error
type SubmitAnswerInput ¶
type SubmitAnswerInput struct { GameID string `validate:"nonzero"` AnswerIdx int `validate:"min=0"` StartAt int64 `validate:"nonzero"` SentAt int64 `validate:"nonzero"` }
func (SubmitAnswerInput) Validate ¶
func (i SubmitAnswerInput) Validate() error
type SubmitAnswerOutput ¶
type TimedQuestion ¶
Click to show internal directories.
Click to hide internal directories.