Documentation ¶
Index ¶
- Constants
- type Buzz
- type PlaySession
- func (s *PlaySession) AddTeam(t *Team)
- func (s *PlaySession) AddTeamPoints(points int, teamName string) (err error)
- func (s *PlaySession) AddUser(u *User)
- func (s *PlaySession) AssignUserToTeam(teamName string, email string) (err error)
- func (s *PlaySession) ClearCurrentAnswer()
- func (s *PlaySession) GetTeam(name string) (t *Team, err error)
- func (s *PlaySession) SetCurrentAnswer(answer string)
- func (s *PlaySession) SetFinished()
- func (s *PlaySession) SetInProgress()
- func (s *PlaySession) UpdateQuestion(q *Question)
- type Question
- type Quiz
- type QuizPGStore
- func (db *QuizPGStore) CreatePlaySession(s *PlaySession) error
- func (db *QuizPGStore) CreateQuestion(q *Question) error
- func (db *QuizPGStore) CreateQuiz(qz *Quiz) error
- func (db *QuizPGStore) CreateUser(u *User) error
- func (db *QuizPGStore) DeletePlaySession(code uint) (err error)
- func (db *QuizPGStore) DeleteQuestion(id uint, quizID uint) error
- func (db *QuizPGStore) DeleteQuiz(id uint) (err error)
- func (db *QuizPGStore) GetAllPublicQuizzes() (qzs []*Quiz, err error)
- func (db *QuizPGStore) GetPlaySession(code uint) (s *PlaySession, err error)
- func (db *QuizPGStore) GetPreloadedQuiz(id uint) (qz *Quiz, err error)
- func (db *QuizPGStore) GetQuestion(id uint) (q *Question, err error)
- func (db *QuizPGStore) GetQuestionsByQuiz(qzID uint) (qq []*Question, err error)
- func (db *QuizPGStore) GetQuiz(id uint) (qz *Quiz, err error)
- func (db *QuizPGStore) GetQuizByName(name string) (qz *Quiz, err error)
- func (db *QuizPGStore) GetQuizzesByUser(email string) (qzs []*Quiz, err error)
- func (db *QuizPGStore) GetTagByName(name string) (t *Tag, err error)
- func (db *QuizPGStore) GetUserByEmail(email string) (*User, error)
- func (db *QuizPGStore) Migrate() error
- func (db *QuizPGStore) UpdatePlaySession(s *PlaySession) error
- func (db *QuizPGStore) UpdateQuestion(id uint, q *Question) error
- func (db *QuizPGStore) UpdateQuiz(qz *Quiz) error
- func (db *QuizPGStore) UpdateTeam(t *Team) error
- func (db *QuizPGStore) UpdateUser(u *User) error
- type QuizStore
- type Tag
- type Team
- type User
Constants ¶
View Source
const StateFinished = "FINISHED"
View Source
const StateInProgress = "INPROGRESS"
View Source
const StateInitialized = "INITIALIZED"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PlaySession ¶
type PlaySession struct { gorm.Model `json:"-"` Code uint `gorm:"uniqueIndex" json:"code"` QuizID uint Quiz *Quiz `json:"quiz"` State string `json:"state"` CurrentQuestionIndex int `json:"current_question_index"` CurrentQuestion *Question `gorm:"-" json:"current_question"` CurrentAnswer string `json:"current_answer,omitempty"` QuizMaster string `json:"quiz_master"` Users []*User `gorm:"many2many:session_users" json:"users"` Teams []*Team `gorm:"many2many:session_teams" json:"teams"` }
func NewPlaySession ¶
func NewPlaySession(qm string, q *Quiz) (s *PlaySession)
func (*PlaySession) AddTeam ¶
func (s *PlaySession) AddTeam(t *Team)
func (*PlaySession) AddTeamPoints ¶
func (s *PlaySession) AddTeamPoints(points int, teamName string) (err error)
func (*PlaySession) AddUser ¶
func (s *PlaySession) AddUser(u *User)
func (*PlaySession) AssignUserToTeam ¶
func (s *PlaySession) AssignUserToTeam(teamName string, email string) (err error)
func (*PlaySession) ClearCurrentAnswer ¶
func (s *PlaySession) ClearCurrentAnswer()
func (*PlaySession) SetCurrentAnswer ¶
func (s *PlaySession) SetCurrentAnswer(answer string)
func (*PlaySession) SetFinished ¶
func (s *PlaySession) SetFinished()
func (*PlaySession) SetInProgress ¶
func (s *PlaySession) SetInProgress()
func (*PlaySession) UpdateQuestion ¶
func (s *PlaySession) UpdateQuestion(q *Question)
type Question ¶
type Question struct { gorm.Model UserID uint `json:"-"` QuizID uint `json:"-"` Points uint `json:"points,omitempty"` Text string `json:"text,omitempty"` ImageLink string `json:"image_link,omitempty"` AudioLink string `json:"audio_link,omitempty"` Answer string `json:"answer,omitempty"` TimerSeconds uint `json:"timer_seconds,omitempty"` Tags []*Tag `gorm:"many2many:question_tags" json:"tags,omitempty"` }
type Quiz ¶
type Quiz struct { gorm.Model Name string `gorm:"uniqueIndex" json:"name"` Private bool `json:"private"` Collaborators []*User `gorm:"many2many:quiz_collaborators" json:"collaborators"` Tags []*Tag `gorm:"many2many:quiz_tags" json:"tags"` Questions []*Question `gorm:"many2many:quiz_questions" json:"questions"` }
func (*Quiz) AddQuestion ¶
func (*Quiz) IsCollaborator ¶
type QuizPGStore ¶
type QuizPGStore struct {
// contains filtered or unexported fields
}
func NewQuizPGStore ¶
func NewQuizPGStore(dsn string) (*QuizPGStore, error)
func (*QuizPGStore) CreatePlaySession ¶
func (db *QuizPGStore) CreatePlaySession(s *PlaySession) error
func (*QuizPGStore) CreateQuestion ¶
func (db *QuizPGStore) CreateQuestion(q *Question) error
func (*QuizPGStore) CreateQuiz ¶
func (db *QuizPGStore) CreateQuiz(qz *Quiz) error
func (*QuizPGStore) CreateUser ¶
func (db *QuizPGStore) CreateUser(u *User) error
func (*QuizPGStore) DeletePlaySession ¶
func (db *QuizPGStore) DeletePlaySession(code uint) (err error)
func (*QuizPGStore) DeleteQuestion ¶
func (db *QuizPGStore) DeleteQuestion(id uint, quizID uint) error
func (*QuizPGStore) DeleteQuiz ¶
func (db *QuizPGStore) DeleteQuiz(id uint) (err error)
func (*QuizPGStore) GetAllPublicQuizzes ¶
func (db *QuizPGStore) GetAllPublicQuizzes() (qzs []*Quiz, err error)
func (*QuizPGStore) GetPlaySession ¶
func (db *QuizPGStore) GetPlaySession(code uint) (s *PlaySession, err error)
func (*QuizPGStore) GetPreloadedQuiz ¶
func (db *QuizPGStore) GetPreloadedQuiz(id uint) (qz *Quiz, err error)
func (*QuizPGStore) GetQuestion ¶
func (db *QuizPGStore) GetQuestion(id uint) (q *Question, err error)
func (*QuizPGStore) GetQuestionsByQuiz ¶
func (db *QuizPGStore) GetQuestionsByQuiz(qzID uint) (qq []*Question, err error)
func (*QuizPGStore) GetQuizByName ¶
func (db *QuizPGStore) GetQuizByName(name string) (qz *Quiz, err error)
func (*QuizPGStore) GetQuizzesByUser ¶
func (db *QuizPGStore) GetQuizzesByUser(email string) (qzs []*Quiz, err error)
func (*QuizPGStore) GetTagByName ¶
func (db *QuizPGStore) GetTagByName(name string) (t *Tag, err error)
func (*QuizPGStore) GetUserByEmail ¶
func (db *QuizPGStore) GetUserByEmail(email string) (*User, error)
func (*QuizPGStore) Migrate ¶
func (db *QuizPGStore) Migrate() error
func (*QuizPGStore) UpdatePlaySession ¶
func (db *QuizPGStore) UpdatePlaySession(s *PlaySession) error
func (*QuizPGStore) UpdateQuestion ¶
func (db *QuizPGStore) UpdateQuestion(id uint, q *Question) error
func (*QuizPGStore) UpdateQuiz ¶
func (db *QuizPGStore) UpdateQuiz(qz *Quiz) error
func (*QuizPGStore) UpdateTeam ¶
func (db *QuizPGStore) UpdateTeam(t *Team) error
func (*QuizPGStore) UpdateUser ¶
func (db *QuizPGStore) UpdateUser(u *User) error
type QuizStore ¶
type QuizStore interface { CreateUser(u *User) error UpdateUser(u *User) error GetUserByEmail(email string) (u *User, err error) CreateQuiz(qz *Quiz) error DeleteQuiz(id uint) error GetQuizByName(name string) (qz *Quiz, err error) GetQuiz(id uint) (qz *Quiz, err error) GetPreloadedQuiz(id uint) (qz *Quiz, err error) GetAllPublicQuizzes() (qzs []*Quiz, err error) GetQuizzesByUser(email string) (qzs []*Quiz, err error) UpdateQuiz(qz *Quiz) error CreateQuestion(q *Question) error UpdateQuestion(id uint, q *Question) error DeleteQuestion(id uint, quizID uint) error GetQuestion(id uint) (q *Question, err error) GetQuestionsByQuiz(qzID uint) (qq []*Question, err error) GetTagByName(name string) (t *Tag, err error) CreatePlaySession(s *PlaySession) error UpdatePlaySession(s *PlaySession) error GetPlaySession(code uint) (s *PlaySession, err error) DeletePlaySession(code uint) (err error) UpdateTeam(t *Team) error }
type Team ¶
type User ¶
type User struct { gorm.Model `json:"-"` Email string `gorm:"uniqueIndex" json:"email,omitempty"` Name string `json:"name,omitempty"` Quizzes []*Quiz `gorm:"many2many:quiz_collaborators" json:"quizzes,omitempty"` Teams []*Team `gorm:"many2many:user_teams" json:"teams,omitempty"` AvatarURL string `json:"avatar_url,omitempty"` }
Click to show internal directories.
Click to hide internal directories.