Documentation ¶
Index ¶
- Constants
- Variables
- func GetUsernamesFromGames(games []objects.Game) []string
- func GetUsers(usernames []string, headers http.Header) ([]objects.User, error)
- func HandlerGetUsers(w http.ResponseWriter, r *http.Request)
- func HandlerNewGame(w http.ResponseWriter, r *http.Request)
- func HandlerSaveGame(w http.ResponseWriter, r *http.Request)
- func Print2D(arr [][]string)
- func Routes() *http.ServeMux
Constants ¶
View Source
const ( // Default rows used for creating a new game. DefaultRows = 15 // Default columns used for creating a new game. DefaultColumns = 10 // Default mines used for creating a new game. DefaultMines = 30 )
Variables ¶
View Source
var Collection string
Instance variable to store the DB Collection name.
View Source
var Database string
Instance variable to store the Database name.
Functions ¶
func GetUsernamesFromGames ¶ added in v0.0.4
Creates a list of usernames from the list of games.
func HandlerGetUsers ¶ added in v0.0.4
func HandlerGetUsers(w http.ResponseWriter, r *http.Request)
Handler for getting the leaderboard based on configuration. Creates a list of users who has games saved for the selected configuration and returns the list in decreasing order of rating.
func HandlerNewGame ¶ added in v0.0.4
func HandlerNewGame(w http.ResponseWriter, r *http.Request)
Handler for creating a new game. Row, Column and Mine count can be passed as query parameters. If any of the count is not available, defaults will be used.
func HandlerSaveGame ¶ added in v0.0.4
func HandlerSaveGame(w http.ResponseWriter, r *http.Request)
Handler for saving a game to the kafka topic. The consumer of the topic saves the game to the DB. The consumer updates the rating of the user in the DB.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.