Documentation ¶
Index ¶
- func CheckPlayerExistsByPhoneNumber(tx *sql.Tx, eventID *string, phoneNumber *string) (bool, error)
- func CreatePlayer(tx *sql.Tx, eventID *string, name *string, league pg.League, ...) error
- func GenerateAuthToken(tx *sql.Tx, eventID *string, phoneNumber *string) error
- func GetEventID(tx *sql.Tx, eventKey *string) (string, error)
- func GetPlayerAuthInfo(tx *sql.Tx, eventID *string, phoneNumber *string) (authToken string, playerID string, role pg.PlayerRole, err error)
- func GetPlayerName(tx *sql.Tx, playerID *string) (string, error)
- func GetPlayerScores(tx *sql.Tx, eventID *string, playerID *string) ([]*pg.Score, error)
- func GetScheduleForEvent(tx *sql.Tx, eventID *string) (pg.VenueList, error)
- func GetScoreboardBestOf5(tx *sql.Tx, eventID *string) ([]*pg.Score, error)
- func GetScoreboardBestOf9(tx *sql.Tx, eventID *string) ([]*pg.Score, error)
- func GetScoreboardIncomplete(tx *sql.Tx, eventID *string) ([]*pg.Score, error)
- func PlayerRoleFromDBFormat(roleRaw []uint8) pg.PlayerRole
- func SetAuthCode(tx *sql.Tx, eventID *string, phoneNumber *string, authCode uint32) error
- func ValidateAuthCode(tx *sql.Tx, eventID *string, phoneNumber *string, authCode uint32) (bool, error)
- func ValidateAuthToken(tx *sql.Tx, authToken *string) (eventID string, playerID string, role pg.PlayerRole, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckPlayerExistsByPhoneNumber ¶
func CheckPlayerExistsByPhoneNumber(tx *sql.Tx, eventID *string, phoneNumber *string) ( bool, error)
CheckPlayerExistsByPhoneNumber returns true if the `eventID` + `phoneNumber` combination is valid.
func CreatePlayer ¶
func CreatePlayer(tx *sql.Tx, eventID *string, name *string, league pg.League, phoneNumber *string, randCode uint32) error
CreatePlayer inserts a new player into the database in an unconfirmed state.
func GenerateAuthToken ¶
GenerateAuthToken un-sets a user's auth code and generates a fresh auth token.
func GetEventID ¶
GetEventID accepts an `eventKey` and returns a corresponding event ID to bypass joins in later queries. An empty string is returned if the event key does not exist.
func GetPlayerAuthInfo ¶
func GetPlayerAuthInfo(tx *sql.Tx, eventID *string, phoneNumber *string) (authToken string, playerID string, role pg.PlayerRole, err error)
GetPlayerAuthInfo returns a user's auth token, ID and role.
func GetPlayerName ¶
GetPlayerName returns the display name for a given `playerID`.
func GetPlayerScores ¶
GetPlayerScores returns all scores for a given player and event.
func GetScheduleForEvent ¶
GetScheduleForEvent returns the venue list for an event.
func GetScoreboardBestOf5 ¶
GetScoreboardBestOf5 returns scores for all players that are eligible for the "Best of 5" category (but not eligible for "Best of 9").
func GetScoreboardBestOf9 ¶
GetScoreboardBestOf9 returns scores for all players that are eligible for the "Best of 9" category.
func GetScoreboardIncomplete ¶
GetScoreboardIncomplete returns scores for all players that aren't eligible for either the "Best of 9" or "Best of 5" categories.
func PlayerRoleFromDBFormat ¶
func PlayerRoleFromDBFormat(roleRaw []uint8) pg.PlayerRole
func SetAuthCode ¶
SetAuthCode updates the auth code (and expiration time) for a player's auth code.
func ValidateAuthCode ¶
func ValidateAuthCode(tx *sql.Tx, eventID *string, phoneNumber *string, authCode uint32) (bool, error)
ValidateAuthCode confirms the validity (equality and expiration window) of a provided `authCode` for a given user.
func ValidateAuthToken ¶
func ValidateAuthToken(tx *sql.Tx, authToken *string) (eventID string, playerID string, role pg.PlayerRole, err error)
ValidateAuthToken returns the corresponding event ID and player ID for a valid `authToken`. In the event of an invalid `authToken`, an empty string will be returned as both IDs.
Types ¶
This section is empty.