Documentation ¶
Index ¶
- Constants
- func NewTeamName(idx int) (name string)
- func ScoreAnswer(matchPoints int, roundNo int) int
- type AddQuestionRequest
- type AddQuestionResponse
- type Answer
- type AuthenticationResponse
- type CreateGameRequest
- type Creator
- type EnterGameRequest
- type Game
- type GameResponse
- type GameSnapRequest
- type Index
- type IndexStore
- type LoginResponse
- type NewQuestion
- type NextQuestionRequest
- type Permission
- type Player
- type Question
- type QuestionBank
- type Request
- type ScoreRequest
- type ScoreResponse
- type Snapshot
- func DecodeSnapshotJsonString(content string) (request Snapshot, err error)
- func InitialSnapshot(quizId string, teams []TeamRoster) (response Snapshot)
- func SnapshotWithAnswer(snapshot Snapshot, answer []string, matchPoints int, teams []TeamRoster) (response Snapshot)
- func SnapshotWithDropPlayer(snapshot Snapshot, teams []TeamRoster) (response Snapshot)
- func SnapshotWithFinish(snapshot Snapshot, teams []TeamRoster) (response Snapshot)
- func SnapshotWithHint(snapshot Snapshot, hint []string, teams []TeamRoster) (response Snapshot)
- func SnapshotWithJoinPlayer(snapshot Snapshot, teams []TeamRoster) (response Snapshot)
- func SnapshotWithNext(snapshot Snapshot, teams []TeamRoster, team_s_turn string, question Question) (response Snapshot)
- func SnapshotWithPass(snapshot Snapshot, teams []TeamRoster, team_s_turn string, roundNo int) (response Snapshot)
- func SnapshotWithStart(snapshot Snapshot, teams []TeamRoster, question Question, teamsTurn string) (response Snapshot)
- type SnapshotResponse
- type Specs
- type StartGameRequest
- type Subscriber
- type Team
- type TeamRoster
- type WebsocketMessage
- type WebsocketMessageCreator
- func (creator WebsocketMessageCreator) InitWebSocketMessage(action actions.Action, content string) (response WebsocketMessage)
- func (creator WebsocketMessageCreator) InitWebSocketMessageFailure() (response WebsocketMessage)
- func (creator WebsocketMessageCreator) WebSocketsResponse(action actions.Action, v interface{}) (res WebsocketMessage)
Constants ¶
View Source
const ( PlayersInATeam = 4 TeamsInAMatch = 4 QuestionsInAMatch = 20 )
Variables ¶
This section is empty.
Functions ¶
func NewTeamName ¶
func ScoreAnswer ¶
Types ¶
type AddQuestionRequest ¶
type AddQuestionRequest struct { Questions []NewQuestion `json:"questions"` Tag string `json:"tag"` }
func DecodeAddQuestionRequest ¶
func DecodeAddQuestionRequest(r *http.Request) (request AddQuestionRequest, err error)
type AddQuestionResponse ¶
type AddQuestionResponse struct { QuestionId string `json:"question_id"` AnswerId string `json:"answer_id"` }
func InitAddQuestionResponse ¶
func InitAddQuestionResponse(question Question, answer Answer) (response AddQuestionResponse)
type Answer ¶
type Answer struct { Id string `json:"id" bson:"_id"` QuestionId string `json:"question_id" bson:"question_id"` Answer []string `json:"answer" bson:"answer"` Hint []string `json:"hints" bson:"hints"` }
func InitNewAnswer ¶
func InitNewAnswer(question Question, newQuestion NewQuestion) (answer Answer)
type AuthenticationResponse ¶
type CreateGameRequest ¶
func DecodeCreateGameRequestJsonString ¶
func DecodeCreateGameRequestJsonString(content string) (request CreateGameRequest, err error)
type Creator ¶
type Creator struct{}
func (Creator) InitSubscriber ¶
func (creator Creator) InitSubscriber(tag string, player Player, role string) (subscriber Subscriber)
type EnterGameRequest ¶
type EnterGameRequest struct { Person Player `json:"person"` QuizId string `json:"quiz_id"` TeamId string `json:"team_id"` }
func DecodeEnterGameRequestJsonString ¶
func DecodeEnterGameRequestJsonString(content string) (request EnterGameRequest, err error)
type Game ¶
type Game struct { Id string `json:"id" bson:"_id"` QuizMaster Player `json:"quizmaster" bson:"quizmaster"` Tags []string `bson:"tags"` Specs Specs `json:"specs" bson:"specs"` Active bool `json:"active" bson:"active"` Started bool `json:"started" bson:"started"` CanJoin bool `json:"can_join"` PlayersJoined int `json:"players_joined"` }
func InitNewMatch ¶
type GameResponse ¶
type GameResponse struct { Quiz Game `json:"quiz"` Snapshot Snapshot `json:"snapshot"` Role string `json:"role"` }
func DecodeGameResponseJsonString ¶
func DecodeGameResponseJsonString(content string) (request GameResponse, err error)
type GameSnapRequest ¶
type GameSnapRequest struct { QuizId string `json:"quiz_id"` TeamSTurn string `json:"team_s_turn"` QuestionId string `json:"question_id"` }
func DecodeGameSnapRequestJsonString ¶
func DecodeGameSnapRequestJsonString(content string) (request GameSnapRequest, err error)
type Index ¶
func InitNewIndex ¶
type IndexStore ¶
type IndexStore struct {
Indexes []string `json:"indexes" bson:"indexes"`
}
type LoginResponse ¶
type LoginResponse struct { Player Player `json:"player"` Tokens AuthenticationResponse `json:"tokens"` Quizmaster bool `json:"quizmaster"` }
func DecodeLoginResponseJsonString ¶
func DecodeLoginResponseJsonString(content string) (request LoginResponse, err error)
type NewQuestion ¶
type NextQuestionRequest ¶
type Permission ¶
type Permission struct {
PlayerId string `json:"player_id" bson:"player_id"`
}
type Player ¶
type Player struct { Id string `json:"id" bson:"_id"` Name string `json:"name" bson:"name"` Email string `json:"email" bson:"email"` }
func InitNewPlayer ¶
type Question ¶
type Question struct { Id string `json:"id" bson:"_id"` Statements []string `json:"statements" bson:"statements"` Tag string `json:"-" bson:"tag"` }
func InitNewQuestion ¶
func InitNewQuestion(index Index, newQuestion NewQuestion) (question Question)
type QuestionBank ¶
type QuestionBank struct {
Questions []NewQuestion `json:"questions"`
}
type ScoreRequest ¶
type ScoreRequest struct {
QuizId string `json:"quiz_id"`
}
func DecodeScoreRequestJsonString ¶
func DecodeScoreRequestJsonString(content string) (request ScoreRequest, err error)
type ScoreResponse ¶
type ScoreResponse struct { QuizId string `json:"quiz_id"` Snapshots []Snapshot `json:"snapshots"` }
func InitScoreResponse ¶
func InitScoreResponse(quizId string, snapshots []Snapshot) (response ScoreResponse)
type Snapshot ¶
type Snapshot struct { QuizId string `json:"quiz_id" bson:"quiz_id"` RoundNo int `json:"round_no" bson:"round_no"` Roster []TeamRoster `json:"teams" bson:"teams"` TeamSTurn string `json:"team_s_turn" bson:"team_s_turn"` QuestionNo int `json:"question_no" bson:"question_no"` QuestionId string `json:"question_id" bson:"question_id"` EventType string `json:"event_type" bson:"event_type"` Score int `json:"score" bson:"score"` Timestamp string `json:"timestamp" bson:"timestamp"` Question []string `json:"question" bson:"question"` Answer []string `json:"answer" bson:"answer"` Hint []string `json:"hint" bson:"hint"` CanPass bool `json:"can_pass"` }
func InitialSnapshot ¶
func InitialSnapshot(quizId string, teams []TeamRoster) (response Snapshot)
func SnapshotWithAnswer ¶
func SnapshotWithAnswer(snapshot Snapshot, answer []string, matchPoints int, teams []TeamRoster) (response Snapshot)
func SnapshotWithDropPlayer ¶
func SnapshotWithDropPlayer(snapshot Snapshot, teams []TeamRoster) (response Snapshot)
func SnapshotWithFinish ¶
func SnapshotWithFinish(snapshot Snapshot, teams []TeamRoster) (response Snapshot)
func SnapshotWithHint ¶
func SnapshotWithHint(snapshot Snapshot, hint []string, teams []TeamRoster) (response Snapshot)
func SnapshotWithJoinPlayer ¶
func SnapshotWithJoinPlayer(snapshot Snapshot, teams []TeamRoster) (response Snapshot)
func SnapshotWithNext ¶
func SnapshotWithNext(snapshot Snapshot, teams []TeamRoster, team_s_turn string, question Question) (response Snapshot)
func SnapshotWithPass ¶
func SnapshotWithPass(snapshot Snapshot, teams []TeamRoster, team_s_turn string, roundNo int) (response Snapshot)
func SnapshotWithStart ¶
func SnapshotWithStart(snapshot Snapshot, teams []TeamRoster, question Question, teamsTurn string) (response Snapshot)
type SnapshotResponse ¶
type StartGameRequest ¶
type StartGameRequest struct {
QuizId string `json:"quiz_id"`
}
func DecodeStartGameRequestJsonString ¶
func DecodeStartGameRequestJsonString(content string) (request StartGameRequest, err error)
type Subscriber ¶
type Team ¶
type Team struct { Id string `json:"id" bson:"_id"` QuizId string `json:"quiz_id" bson:"quiz_id"` Name string `json:"name" bson:"name"` Score int `json:"score" bson:"score"` }
func InitNewTeam ¶
func InitNewTeams ¶
type TeamRoster ¶
type WebsocketMessage ¶
func DecodeWebSocketRequest ¶
func DecodeWebSocketRequest(input []byte) (request WebsocketMessage, err error)
type WebsocketMessageCreator ¶
type WebsocketMessageCreator struct{}
func (WebsocketMessageCreator) InitWebSocketMessage ¶
func (creator WebsocketMessageCreator) InitWebSocketMessage(action actions.Action, content string) (response WebsocketMessage)
func (WebsocketMessageCreator) InitWebSocketMessageFailure ¶
func (creator WebsocketMessageCreator) InitWebSocketMessageFailure() (response WebsocketMessage)
func (WebsocketMessageCreator) WebSocketsResponse ¶
func (creator WebsocketMessageCreator) WebSocketsResponse(action actions.Action, v interface{}) (res WebsocketMessage)
Click to show internal directories.
Click to hide internal directories.