package
0.0.0-20250113071249-892427ca9338
Repository: https://github.com/gocs/davy.git
Documentation: pkg.go.dev
# Functions
AuthenticateUser authenticates the user by its username and password.
GetAllQuestions All Updates getter.
GetAllUpdates All Updates getter.
GetCurrentStandings list the raks of the 12 users above and below your current standing.
GetLobbyByCode get the lobby based on the given code.
No description provided by the author
GetQuestion retrieves a whole struct of question from the database.
GetQuestions gets all updates related to the user.
GetRank returns the current rank of the user.
GetUpdates gets all updates related to the user.
GetUserByUserID gets user using a user id.
GetUserByUsername gets the user using the username.
GetUserIDByUser gets the user id using the user.
GetUserQuestion gets UserQuestion using user id.
GetUserQuestionsLen Questions len getter.
IsUser checks if username has registered in this site.
JoinLobby joins the user to the lobby from the given code.
JoinOrCreateLobby process whether the lobby is joined or created by the current user.
MigrateQuestions sends the questions.json to the redis server.
NewLobby creates new lobby, saves it to the database, and returns the newly created lobby.
NewQuestion creates a new question, saves it to the database, and returns the newly created question.
NewRedisDB instantiates a package-level redis client access.
NewUpdate creates a new update, saves it to the database, and returns the newly created question.
NewUser create a new user, saves it to the database, and returns the newly created user.
PostUpdate adds a new update.
RegisterUser register a valid user.
TopRanks lists the overall top 25.
UpdateRank replaces the user's points with a new value.
UserConfirmAnswer returns true of false if the answer is correct and it gives the user's points wtih new question as a result of choosing the right answer.
# Constants
StatusEnded means the status is "ended".
StatusOngoing means the status is "on-going".
StatusStarting means the status is "starting".
StatusWaiting means the status is "waiting".
# Variables
ErrEmptyUserQuestion specific error for capturing uninitialized array error.
ErrGameEnded gives error message when the game has already ended.
ErrInvalidLogin common error on login form when the user does not match its login credentials.
ErrLobbyEmptyMembers gives error message when the lobby has no members.
ErrNilClient gives error message when redis client variable is nil.
ErrQuestionDuplicate specific error on whether the question has already been asked.
ErrTypeMismatch specific error for capturing type mismatch.
ErrUserInLobby gives error message when user attempts to join a lobby when is already in lobby.
ErrUsernameTaken common error on registration form when the username already existed.
ErrUserNotFound common error on login form when the user is not found.
ErrUserNotInLobby gives error message when user attempts to get its current lobby when is not in lobby.
# Structs
Lobby is a manager for accessing users in the database.
Question is a manager for accessing questions in the database.
QuestionT is a unit for the exam.
RankT is a simple data struct for a sorted leaderboard.
Update is a manager for accessing updates in the database.
User is a manager for accessing users in the database.
UserQuestion is a manager for accessing users' current question status in the database.