Documentation ¶
Overview ¶
logstf does mostly ETL stuff for the logstf data
Index ¶
- Variables
- func DefaultTableOpts() *tableOpts
- func Exists(path string) bool
- func FetchAPIFile(logId int64, path string) error
- func FetchLogFile(client *http.Client, logId int64, savePath string) error
- func GetLatestLogId() (int64, error)
- func Insert(conn *sqlx.DB, s *LogSummary) error
- func LogCacheFile(logId int64, fileType FileFormat) string
- func Rollback(tx *sqlx.Tx)
- func ToTable(rows [][]string, opts *tableOpts) string
- func UpdateCache(baseDir string, lookBackSize int64) error
- type AmmoPack
- type ApiResponse
- type Downloader
- type FileFormat
- type HealingSummary
- type HealthPack
- type Kill
- type LogSummary
- func (s *LogSummary) Apply(line string)
- func (s *LogSummary) GetPlayersByClass(class PlayerClass) []*Player
- func (s *LogSummary) LoadApiResponse(r *ApiResponse) error
- func (s *LogSummary) PrintHealing()
- func (s *LogSummary) PrintPlayers(sortBy SortAttr)
- func (s *LogSummary) TotalLength() time.Duration
- type Medigun
- type Message
- type MsgType
- type Player
- type PlayerClass
- type Position
- type RoundSummary
- type SortAttr
- type Team
- type TeamStats
- type TeamSummary
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrBadStatus error
View Source
var ErrNotFound error
View Source
var ErrTooMany error
Functions ¶
func DefaultTableOpts ¶
func DefaultTableOpts() *tableOpts
func FetchAPIFile ¶
func GetLatestLogId ¶
func LogCacheFile ¶
func LogCacheFile(logId int64, fileType FileFormat) string
func UpdateCache ¶
UpdateCache does a more shallow update cycle meant to watch the homepage for new logs. Use the Downloader for fetching the full database from logstf
Types ¶
type ApiResponse ¶
type ApiResponse struct { Version int `json:"version"` Teams struct { Red TeamStats `json:"Red"` Blue TeamStats `json:"Blue"` } `json:"teams"` Length int `json:"length"` Players map[string]playerStats `json:"players"` Names map[string]string `json:"names"` Rounds []struct { StartTime int `json:"start_time"` Winner string `json:"winner"` Team struct { Blu teamRound `json:"blue"` Red teamRound `json:"red"` } `json:"team"` Events []struct { Type string `json:"type"` Time int `json:"time"` Team string `json:"team"` Steamid string `json:"steamid,omitempty"` Killer string `json:"killer,omitempty"` Point int `json:"point,omitempty"` Medigun string `json:"medigun,omitempty"` } `json:"events"` //Players interface{} `json:"players"` FirstCap string `json:"firstcap"` Length int64 `json:"length"` } `json:"rounds"` HealSpread map[string]map[string]int `json:"healspread"` ClassKills map[string]classKills `json:"classkills"` ClassDeaths map[string]classKills `json:"classdeaths"` ClassKillAssists map[string]classKills `json:"classkillassists"` Chat []struct { Steamid string `json:"steamid"` Name string `json:"name"` Msg string `json:"msg"` } `json:"chat"` Info struct { Map string `json:"map"` Supplemental bool `json:"supplemental"` TotalLength int64 `json:"total_length"` HasRealDamage bool `json:"hasRealDamage"` HasWeaponDamage bool `json:"hasWeaponDamage"` HasAccuracy bool `json:"hasAccuracy"` HasHP bool `json:"hasHP"` HasHPReal bool `json:"hasHP_real"` HasHS bool `json:"hasHS"` HasHSHit bool `json:"hasHS_hit"` HasBS bool `json:"hasBS"` HasCP bool `json:"hasCP"` HasSB bool `json:"hasSB"` HasDT bool `json:"hasDT"` HasAS bool `json:"hasAS"` HasHR bool `json:"hasHR"` HasIntel bool `json:"hasIntel"` ADScoring bool `json:"AD_scoring"` Notifications []interface{} `json:"notifications"` Title string `json:"title"` Date int64 `json:"date"` Uploader struct { ID string `json:"id"` Name string `json:"name"` Info string `json:"info"` } `json:"uploader"` } `json:"info"` KillStreaks []killStreak `json:"killstreaks"` Success bool `json:"success"` }
func FetchAPI ¶
func FetchAPI(logId int64) (*ApiResponse, error)
func ReadJSON ¶
func ReadJSON(logId int64) (*ApiResponse, error)
func (*ApiResponse) Summary ¶
func (a *ApiResponse) Summary() *LogSummary
type Downloader ¶
type Downloader struct { Failures int64 Successes int64 Overwrite bool // contains filtered or unexported fields }
func NewDownloader ¶
func NewDownloader(penaltyIncrement int) *Downloader
func (*Downloader) AddRequest ¶
func (d *Downloader) AddRequest(url string, path string)
func (*Downloader) Stop ¶
func (d *Downloader) Stop()
func (*Downloader) Wait ¶
func (d *Downloader) Wait()
type FileFormat ¶
type FileFormat string
const JSONFormat FileFormat = ".json"
const ZipFormat FileFormat = ".zip"
type HealingSummary ¶
type HealingSummary struct { Healing int64 Charges map[Medigun]int ChargeLengths []float64 Drops int AvgTimeToBuild int AvgTimeBeforeUsing int NearFullChargeDeaths int DeathsAfterCharge int MajorAdvantagesLost int BiggestAdvantageLost int Targets map[*Player]int64 // contains filtered or unexported fields }
func NewHealingSummary ¶
func NewHealingSummary() *HealingSummary
func (*HealingSummary) AvgUberLen ¶
func (h *HealingSummary) AvgUberLen() float64
func (*HealingSummary) Table ¶
func (h *HealingSummary) Table(name string) string
type HealthPack ¶
type HealthPack int
type LogSummary ¶
type LogSummary struct { Id int Players map[steamid.SID64]*Player Teams map[Team]*TeamSummary MatchName string ServerName string Map string ScoreRed int ScoreBlu int Duration time.Duration CreatedOn time.Time Rounds []*RoundSummary Messages []Message // contains filtered or unexported fields }
func Get ¶
func Get(logId int64) (*LogSummary, error)
func NewSummary ¶
func NewSummary() *LogSummary
func (*LogSummary) Apply ¶
func (s *LogSummary) Apply(line string)
Apply will parse the input line and send the results to the appropriate method to apply the state update.1
NOTE We are relying on the rx engine to match group names, so we dont check most keys first
func (*LogSummary) GetPlayersByClass ¶
func (s *LogSummary) GetPlayersByClass(class PlayerClass) []*Player
func (*LogSummary) LoadApiResponse ¶
func (s *LogSummary) LoadApiResponse(r *ApiResponse) error
func (*LogSummary) PrintHealing ¶
func (s *LogSummary) PrintHealing()
func (*LogSummary) PrintPlayers ¶
func (s *LogSummary) PrintPlayers(sortBy SortAttr)
func (*LogSummary) TotalLength ¶
func (s *LogSummary) TotalLength() time.Duration
type Player ¶
type Player struct { Name string SteamId steamid.SID64 Team Team Kills []Kill Deaths []Kill Assists int Revenges int Dominations int Dominated int Healed int64 // self healing, not medic healing Damage int64 DamageTaken int64 SmallMedPacks int MediumMedPacks int FullMedPacks int ShotsFired int ShotsHit int BackStabs int HeadShots int AirShots int Captures int Defenses int Classes map[PlayerClass]classStats // Classes we have played HealingSum *HealingSummary // Medic players will get a healing summary CurrentClass PlayerClass // contains filtered or unexported fields }
Player represents a player on the server. The base properties are global across the match.
func NewPlayer ¶
func NewPlayer(sum *LogSummary) *Player
func (*Player) AddClass ¶
func (p *Player) AddClass(cls PlayerClass)
func (*Player) DamagePerMin ¶
func (*Player) DamageTakenPerMin ¶
type PlayerClass ¶
type PlayerClass int
type RoundSummary ¶
Click to show internal directories.
Click to hide internal directories.