Documentation ¶
Index ¶
- func ReadQueryFile(filename string) string
- type Achievement
- type Credentials
- type LeaderbordEntry
- type LogicAppServer
- type MyUserStore
- func (us *MyUserStore) Achievements(user_id int) ([]Achievement, error)
- func (us *MyUserStore) CalculatePoints(ss SolveSubmission) (int, error)
- func (us *MyUserStore) FindQuiz(user_id int, qc QuizProperties) (Quiz, error)
- func (us *MyUserStore) GetCompetitionQuiz(user_id int) (Quiz, error)
- func (us *MyUserStore) Leaderboard() ([]LeaderbordEntry, error)
- func (us *MyUserStore) Login(credentials Credentials) (string, error)
- func (us *MyUserStore) Logout(token string) error
- func (us *MyUserStore) ResetUser(userId int) error
- func (us *MyUserStore) Signup(credential Credentials) error
- func (us *MyUserStore) SolveQuiz(userId int, ss SolveSubmission) (SolveSubmissionResponse, error)
- func (us *MyUserStore) UpdateAchievements(userId int) error
- func (us *MyUserStore) UserIdFromToken(token string) (int, error)
- type PlayersHandler
- type Quiz
- type QuizHandler
- type QuizProperties
- type SolveSubmission
- type SolveSubmissionResponse
- type UserHandler
- func (uh *UserHandler) LoginHandler(w http.ResponseWriter, r *http.Request)
- func (uh *UserHandler) LogoutHandler(w http.ResponseWriter, r *http.Request)
- func (uh *UserHandler) ResetHandler(w http.ResponseWriter, r *http.Request)
- func (uh *UserHandler) SignupHandler(w http.ResponseWriter, r *http.Request)
- type UserStore
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ReadQueryFile ¶
ReadQueryFile reads a SQL file and returns the contents as a string
Types ¶
type Achievement ¶
type Credentials ¶
type LeaderbordEntry ¶
type LogicAppServer ¶
func NewLogicAppServer ¶
func NewLogicAppServer(db *sql.DB) *LogicAppServer
type MyUserStore ¶
func NewMyUserStore ¶
func NewMyUserStore(db *sql.DB) *MyUserStore
func (*MyUserStore) Achievements ¶
func (us *MyUserStore) Achievements(user_id int) ([]Achievement, error)
func (*MyUserStore) CalculatePoints ¶
func (us *MyUserStore) CalculatePoints(ss SolveSubmission) (int, error)
func (*MyUserStore) FindQuiz ¶
func (us *MyUserStore) FindQuiz(user_id int, qc QuizProperties) (Quiz, error)
func (*MyUserStore) GetCompetitionQuiz ¶
func (us *MyUserStore) GetCompetitionQuiz(user_id int) (Quiz, error)
func (*MyUserStore) Leaderboard ¶
func (us *MyUserStore) Leaderboard() ([]LeaderbordEntry, error)
func (*MyUserStore) Login ¶
func (us *MyUserStore) Login(credentials Credentials) (string, error)
func (*MyUserStore) Logout ¶
func (us *MyUserStore) Logout(token string) error
func (*MyUserStore) ResetUser ¶
func (us *MyUserStore) ResetUser(userId int) error
func (*MyUserStore) Signup ¶
func (us *MyUserStore) Signup(credential Credentials) error
func (*MyUserStore) SolveQuiz ¶
func (us *MyUserStore) SolveQuiz(userId int, ss SolveSubmission) (SolveSubmissionResponse, error)
func (*MyUserStore) UpdateAchievements ¶
func (us *MyUserStore) UpdateAchievements(userId int) error
func (*MyUserStore) UserIdFromToken ¶
func (us *MyUserStore) UserIdFromToken(token string) (int, error)
type PlayersHandler ¶
func NewPlayersHandler ¶
func NewPlayersHandler(store UserStore) *PlayersHandler
func (*PlayersHandler) AchievementsHandler ¶
func (uh *PlayersHandler) AchievementsHandler(w http.ResponseWriter, r *http.Request)
func (*PlayersHandler) LeaderboardHandler ¶
func (uh *PlayersHandler) LeaderboardHandler(w http.ResponseWriter, r *http.Request)
type QuizHandler ¶
func NewQuizHandler ¶
func NewQuizHandler(store UserStore) *QuizHandler
func (*QuizHandler) CompetitionHandler ¶
func (uh *QuizHandler) CompetitionHandler(w http.ResponseWriter, r *http.Request)
func (*QuizHandler) FindHandler ¶
func (uh *QuizHandler) FindHandler(w http.ResponseWriter, r *http.Request)
func (*QuizHandler) SolveHandler ¶
func (uh *QuizHandler) SolveHandler(w http.ResponseWriter, r *http.Request)
type QuizProperties ¶
func QuizPropertiesFromUrlQuery ¶
func QuizPropertiesFromUrlQuery(queryParams url.Values) (QuizProperties, error)
type SolveSubmission ¶
type SolveSubmissionResponse ¶
type SolveSubmissionResponse struct {
Points int `json:"points"`
}
type UserHandler ¶
func NewUserHandler ¶
func NewUserHandler(store UserStore) *UserHandler
func (*UserHandler) LoginHandler ¶
func (uh *UserHandler) LoginHandler(w http.ResponseWriter, r *http.Request)
func (*UserHandler) LogoutHandler ¶
func (uh *UserHandler) LogoutHandler(w http.ResponseWriter, r *http.Request)
func (*UserHandler) ResetHandler ¶
func (uh *UserHandler) ResetHandler(w http.ResponseWriter, r *http.Request)
func (*UserHandler) SignupHandler ¶
func (uh *UserHandler) SignupHandler(w http.ResponseWriter, r *http.Request)
type UserStore ¶
type UserStore interface { Signup(c Credentials) error Login(c Credentials) (string, error) Logout(token string) error UserIdFromToken(token string) (int, error) ResetUser(userId int) error Achievements(user_id int) ([]Achievement, error) Leaderboard() ([]LeaderbordEntry, error) GetCompetitionQuiz(user_id int) (Quiz, error) FindQuiz(user_id int, qc QuizProperties) (Quiz, error) SolveQuiz(user_id int, ss SolveSubmission) (SolveSubmissionResponse, error) }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.