Documentation
¶
Index ¶
Constants ¶
View Source
const ( DIAMOND GenType = "diamond" GOLD GenType = "gold" IRON GenType = "iron" MIDDLE GenLocation = "middle" SEMIMIDDLE GenLocation = "semimiddle" BASE GenLocation = "base" )
View Source
const HOLDER_KEY string = "holder"
View Source
const LEADERBOARD_SIZE int = 200
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChestLocation ¶
type DatabaseProvider ¶
type DatabaseProvider interface {
GetBackingDB() *sql.DB
// GetSeasons returns all seasons if active is true, otherwise it returns all seasons
GetSeasons(active bool) ([]Season, error)
// GetCurrentChestLocations returns all chest locations for the current season
GetCurrentChestLocations() ([]ChestLocation, error)
// GetChestLocations returns all chest locations for the given season
GetChestLocations(season string) ([]ChestLocation, error)
// GetEggWarsMaps returns all egg wars maps
GetEggWarsMaps() ([]EggWarsMap, error)
// GetEggWarsMap returns the egg wars map with the given unique name
GetEggWarsMap(uniqueName string) (*EggWarsMap, error)
// GetGames returns all games if active is true, otherwise it returns all games
GetGames(active bool) ([]Game, error)
// GetLeaderboard returns the top 200 players for the given game. This may be the UniqueName, DisplayName or an Alias
GetLeaderboard(game string) ([]LeaderboardRow, error)
// GetLeaderboardBounded returns the top players for the given game between the start and end
GetLeaderboardBounded(game string, start int, end int) ([]LeaderboardRow, error)
// GetLeaderboardForPlayer returns the leaderboard for the given player
GetLeaderboardForPlayer(player string) ([]LeaderboardRow, error)
// SubmitLeaderboard submits the given leaderboard submission to the database
SubmitLeaderboard(submission LeaderboardSubmission) error
}
type EggWarsMap ¶
type GamesProvider ¶
type GenLocation ¶
type GenLocation string
type Holder ¶
type Holder interface {
GetDatabaseProvider() DatabaseProvider
GetGamesProvider() GamesProvider
GetPlayerLocationProvider() PlayerLocationProvider
}
type LeaderboardRow ¶
type LeaderboardRow struct {
Game string `json:"game" validate:"nonzero,regexp=[a-zA-Z0-9_ ]"`
Player string `json:"player" validate:"nonzero,regexp=[a-zA-Z0-9_]{3\\,16}"`
Position int `json:"position" validate:"nonzero,min=1,max=200"`
Score int `json:"score" validate:"nonzero"`
UnixTimeStamp int `json:"unix_time_stamp"`
}
type LeaderboardSubmission ¶
type LeaderboardSubmission struct {
Uuid string `json:"uuid" validate:"nonzero,regexp=^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"`
UnixTimeStamp uint64 `json:"unix_time_stamp" validate:"nonzero"`
Game string `json:"game" validate:"nonzero,regexp=[a-zA-Z0-9_ ]"`
Entries []LeaderboardRow `json:"entries" validate:"nonzero,len=200"`
}
type PlayerLocationProvider ¶
type PlayerLocationProvider interface {
// GetPlayerLocation returns the location of the player with the given UUID.
GetPlayerLocation(uuid string) (*Location, error)
// SetPlayerLocation sets the location of the player with the given UUID.
SetPlayerLocation(uuid string, location Location) error
// RemovePlayerLocation removes the location of the player with the given UUID.
RemovePlayerLocation(uuid string) error
GetSharedPlayers(uuid string) ([]string, error)
}
Click to show internal directories.
Click to hide internal directories.