api

package
v0.0.1-preview-a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 27, 2019 License: MIT Imports: 11 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckLoggedIn

func CheckLoggedIn(w http.ResponseWriter, r *http.Request)

func CheckUserCanEdit

func CheckUserCanEdit(w http.ResponseWriter, r *http.Request)

func GetMatchInfo

func GetMatchInfo(w http.ResponseWriter, r *http.Request)

func GetMatches

func GetMatches(w http.ResponseWriter, r *http.Request)

func GetMetrics

func GetMetrics(w http.ResponseWriter, r *http.Request)

func GetPlayerStatInfo

func GetPlayerStatInfo(w http.ResponseWriter, r *http.Request)

func GetRecentMatches

func GetRecentMatches(w http.ResponseWriter, r *http.Request)

func GetServerInfo

func GetServerInfo(w http.ResponseWriter, r *http.Request)

func GetStatusString

func GetStatusString(w http.ResponseWriter, r *http.Request)

func GetSteamName

func GetSteamName(w http.ResponseWriter, r *http.Request)

func GetTeamInfo

func GetTeamInfo(w http.ResponseWriter, r *http.Request)

func GetUserInfo

func GetUserInfo(w http.ResponseWriter, r *http.Request)

Types

type APIGameServerData

type APIGameServerData struct {
	ID           int    `gorm:"primary_key;column:id;AUTO_INCREMENT;NOT NULL" json:"id"`
	UserID       int    `gorm:"column:user_id;DEFAULT NULL" json:"user_id"`
	InUse        bool   `gorm:"column:in_use;DEFAULT NULL" json:"in_use"`
	IPString     string `gorm:"column:ip_string;DEFAULT NULL" json:"ip_string"`
	Port         int    `gorm:"column:port;DEFAULT NULL" json:"port"`
	Display      string `gorm:"column:display_name" json:"display_name"`
	PublicServer bool   `gorm:"column:public_server;DEFAULT NULL" json:"public_server"`
}

GameServerData Struct for game_server table.

func (*APIGameServerData) TableName

func (u *APIGameServerData) TableName() string

TableName declairation for GORM

type APIMapStatsData

type APIMapStatsData struct {
	ID            int          `gorm:"primary_key" gorm:"column:id" json:"id"`
	MatchID       int          `gorm:"column:match_id" gorm:"ForeignKey:match_id" json:"match_id"`
	MapNumber     int          `gorm:"column:map_number" json:"map_number"`
	MapName       string       `gorm:"column:map_name" json:"map_name"`
	StartTime     sql.NullTime `gorm:"column:start_time" json:"-"`
	StartTimeJSON time.Time    `json:"start_time"`
	EndTime       sql.NullTime `gorm:"column:end_time" json:"-"`
	EndTimeJSON   time.Time    `json:"end_time"`
	Winner        int          `gorm:"column:winner" json:"winner"`
	Team1Score    int          `gorm:"column:team1_score" json:"team1_score"`
	Team2Score    int          `gorm:"column:team2_score" json:"team2_score"`
}

APIMapStatsData MapStatsData struct for map_stats table.

func (*APIMapStatsData) TableName

func (u *APIMapStatsData) TableName() string

TableName declairation for GORM

type APIMatchData

type APIMatchData struct {
	ID            int64        `gorm:"primary_key;column:id" json:"id"`
	UserID        int64        `gorm:"column:user_id" json:"user_id"`
	Team1         APITeamData  `json:"team1"`
	Team2         APITeamData  `json:"team2"`
	Winner        int64        `gorm:"column:winner" json:"winner"`
	Cancelled     bool         `gorm:"column:cancelled" json:"cancelled"`
	StartTime     sql.NullTime `gorm:"column:start_time" json:"-"`
	StartTimeJSON time.Time    `json:"start_time"`
	EndTime       sql.NullTime `gorm:"column:end_time" json:"-"`
	EndTimeJSON   time.Time    `json:"end_time"`
	MaxMaps       int          `gorm:"column:max_maps" json:"max_maps"`
	Title         string       `gorm:"column:title" json:"title"`
	SkipVeto      bool         `gorm:"column:skip_veto" json:"skip_veto"`
	VetoMapPool   []string     `gorm:"column:veto_mappool" json:"veto_mappool"`
	Team1Score    int          `gorm:"column:team1_score" json:"team1_score"`
	Team2Score    int          `gorm:"column:team2_score" json:"team2_score"`
	Team1String   string       `gorm:"column:team1_string" json:"team1_string"`
	Team2String   string       `gorm:"column:team2_string" json:"team2_string"`
	Forfeit       bool         `gorm:"column:forfeit" json:"forfeit"`

	MapStats []APIMapStatsData `json:"map_stats"`
	Server   APIGameServerData `json:"server"`
	User     APIUserData       `json:"user"`

	Pending bool   `json:"pending"`
	Live    bool   `json:"live"`
	Status  string `json:"status"`
}

APIMatchData Struct for match table.

func (*APIMatchData) TableName

func (u *APIMatchData) TableName() string

TableName declairation for GORM

type APIPlayerStatsData

type APIPlayerStatsData struct {
	ID               int    `gorm:"primary_key;column:id" json:"id"`
	MatchID          int    `gorm:"column:match_id" json:"match_id"`
	MapID            int    `gorm:"column:map_id" json:"map_id"`
	TeamID           int    `gorm:"column:team_id" json:"team_id"`
	SteamID          string `gorm:"column:steam_id;unique" json:"steam_id"`
	Name             string `gorm:"column:name" json:"name"`
	Kills            int    `gorm:"column:kills" json:"kills"`
	Deaths           int    `gorm:"column:deaths" json:"deaths"`
	Roundsplayed     int    `gorm:"column:roundsplayed" json:"roundsplayed"`
	Assists          int    `gorm:"column:assists" json:"assists"`
	FlashbangAssists int    `gorm:"column:flashbang_assists" json:"flashbang_assists"`
	Teamkills        int    `gorm:"column:teamkills" json:"teamkills"`
	Suicides         int    `gorm:"column:suicides" json:"suicides"`
	HeadshotKills    int    `gorm:"column:headshot_kills" json:"headshot_kills"`
	Damage           int64  `gorm:"column:damage" json:"damage"`
	BombPlants       int    `gorm:"column:bomb_plants" json:"bomb_plants"`
	BombDefuses      int    `gorm:"column:bomb_defuses" json:"bomb_defuses"`
	V1               int    `gorm:"column:v1" json:"v1"`
	V2               int    `gorm:"column:v2" json:"v2"`
	V3               int    `gorm:"column:v3" json:"v3"`
	V4               int    `gorm:"column:v4" json:"v4"`
	V5               int    `gorm:"column:v5" json:"v5"`
	K1               int    `gorm:"column:k1" json:"k1"`
	K2               int    `gorm:"column:k2" json:"k2"`
	K3               int    `gorm:"column:k3" json:"k3"`
	K4               int    `gorm:"column:k4" json:"k4"`
	K5               int    `gorm:"column:k5" json:"k5"`
	FirstdeathCT     int    `gorm:"column:firstdeath_Ct" json:"firstdeath_Ct"`
	FirstdeathT      int    `gorm:"column:firstdeath_t" json:"firstdeath_t"`
	FirstkillCT      int    `gorm:"column:firstkill_ct" json:"firstkill_ct"`
	FirstkillT       int    `gorm:"column:firstkill_t" json:"firstkill_t"`

	Rating float64 `json:"rating"`
	KDR    float64 `json:"kdr"`
	HSP    float64 `json:"hsp"`
	ADR    float64 `json:"adr"`
	FPR    float64 `json:"fpr"`
}

APIPlayerStatsData Player stats data struct for player_stats table.

func (*APIPlayerStatsData) GetADR

func (p *APIPlayerStatsData) GetADR() float64

GetADR Returns player's ADR(Average Damage per Round).

func (*APIPlayerStatsData) GetFPR

func (p *APIPlayerStatsData) GetFPR() float64

GetFPR Returns player's FPR(Frags Per Round).

func (*APIPlayerStatsData) GetHSP

func (p *APIPlayerStatsData) GetHSP() float64

GetHSP Returns player's HSP(HeadShot Percentage).

func (*APIPlayerStatsData) GetKDR

func (p *APIPlayerStatsData) GetKDR() float64

GetKDR Returns player's KDR(Kill/Deaths Ratio).

func (*APIPlayerStatsData) GetRating

func (p *APIPlayerStatsData) GetRating() float64

GetRating Get player's rating. Average datas are static tho.

func (*APIPlayerStatsData) TableName

func (u *APIPlayerStatsData) TableName() string

TableName declairation for GORM

type APITeamData

type APITeamData struct {
	ID          int      `gorm:"primary_key;column:id" json:"id"`
	UserID      int      `gorm:"column:user_id" json:"user_id"`
	Name        string   `gorm:"column:name" json:"name"`
	Tag         string   `gorm:"column:tag" json:"tag"`
	Flag        string   `gorm:"column:flag" json:"flag"`
	AuthsPickle []byte   `gorm:"column:auths" json:"-"`
	SteamIDs    []string `gorm:"-" json:"steamids"`
	PublicTeam  bool     `gorm:"column:public_team" json:"public_team"`

	User APIUserData `gorm:"ASSOCIATION_FOREIGNKEY:user_id" json:"-"`
}

TeamData Struct for team table.

func (*APITeamData) GetPlayers

func (t *APITeamData) GetPlayers() ([]string, error)

GetPlayers Gets registered player's steamid64.

func (*APITeamData) TableName

func (u *APITeamData) TableName() string

TableName declairation for GORM

type APIUserData

type APIUserData struct {
	ID      int    `gorm:"primary_key;column:id;AUTO_INCREMENT" json:"id"`
	SteamID string `gorm:"column:steam_id;unique" json:"steam_id"`
	Name    string `gorm:"column:name" json:"name"`
	Admin   bool   `gorm:"column:admin" json:"admin"`

	Servers []APIGameServerData `gorm:"foreignkey:-" json:"servers"`
	Teams   []APITeamData       `gorm:"foreignkey:-" json:"teams"`
	Matches []APIMatchData      `gorm:"foreignkey:-" json:"matches"`
}

UserData Struct for "user" table.

func (*APIUserData) TableName

func (u *APIUserData) TableName() string

TableName declairation for GORM

type CheckLoggedInJSON

type CheckLoggedInJSON struct {
	IsLoggedIn bool   `json:"isLoggedIn"`
	SteamID    string `json:"steamid"`
	UserID     int    `json:"userid"`
}

type SimpleJSONResponse

type SimpleJSONResponse struct {
	Response     string `json:"response"`
	Errorcode    int    `json:"errorcode"`
	Errormessage string `json:"errormessage"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL