added detailed parsing of player hurt events
This commit is contained in:
@@ -2,6 +2,10 @@
|
||||
|
||||
package stats
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
const (
|
||||
// Label holds the string label denoting the stats type in the database.
|
||||
Label = "stats"
|
||||
@@ -21,12 +25,76 @@ const (
|
||||
FieldMvp = "mvp"
|
||||
// FieldScore holds the string denoting the score field in the database.
|
||||
FieldScore = "score"
|
||||
// FieldExtended holds the string denoting the extended field in the database.
|
||||
FieldExtended = "extended"
|
||||
// FieldRankNew holds the string denoting the rank_new field in the database.
|
||||
FieldRankNew = "rank_new"
|
||||
// FieldRankOld holds the string denoting the rank_old field in the database.
|
||||
FieldRankOld = "rank_old"
|
||||
// FieldMk2 holds the string denoting the mk_2 field in the database.
|
||||
FieldMk2 = "mk_2"
|
||||
// FieldMk3 holds the string denoting the mk_3 field in the database.
|
||||
FieldMk3 = "mk_3"
|
||||
// FieldMk4 holds the string denoting the mk_4 field in the database.
|
||||
FieldMk4 = "mk_4"
|
||||
// FieldMk5 holds the string denoting the mk_5 field in the database.
|
||||
FieldMk5 = "mk_5"
|
||||
// FieldDmgEnemy holds the string denoting the dmg_enemy field in the database.
|
||||
FieldDmgEnemy = "dmg_enemy"
|
||||
// FieldDmgTeam holds the string denoting the dmg_team field in the database.
|
||||
FieldDmgTeam = "dmg_team"
|
||||
// FieldUdHe holds the string denoting the ud_he field in the database.
|
||||
FieldUdHe = "ud_he"
|
||||
// FieldUdFlames holds the string denoting the ud_flames field in the database.
|
||||
FieldUdFlames = "ud_flames"
|
||||
// FieldUdFlash holds the string denoting the ud_flash field in the database.
|
||||
FieldUdFlash = "ud_flash"
|
||||
// FieldUdDecoy holds the string denoting the ud_decoy field in the database.
|
||||
FieldUdDecoy = "ud_decoy"
|
||||
// FieldUdSmoke holds the string denoting the ud_smoke field in the database.
|
||||
FieldUdSmoke = "ud_smoke"
|
||||
// FieldHitGroupHead holds the string denoting the hit_group_head field in the database.
|
||||
FieldHitGroupHead = "hit_group_head"
|
||||
// FieldHitGroupChest holds the string denoting the hit_group_chest field in the database.
|
||||
FieldHitGroupChest = "hit_group_chest"
|
||||
// FieldHitGroupStomach holds the string denoting the hit_group_stomach field in the database.
|
||||
FieldHitGroupStomach = "hit_group_stomach"
|
||||
// FieldHitGroupLeftArm holds the string denoting the hit_group_left_arm field in the database.
|
||||
FieldHitGroupLeftArm = "hit_group_left_arm"
|
||||
// FieldHitGroupRightArm holds the string denoting the hit_group_right_arm field in the database.
|
||||
FieldHitGroupRightArm = "hit_group_right_arm"
|
||||
// FieldHitGroupLeftLeg holds the string denoting the hit_group_left_leg field in the database.
|
||||
FieldHitGroupLeftLeg = "hit_group_left_leg"
|
||||
// FieldHitGroupRightLeg holds the string denoting the hit_group_right_leg field in the database.
|
||||
FieldHitGroupRightLeg = "hit_group_right_leg"
|
||||
// FieldHitGroupGear holds the string denoting the hit_group_gear field in the database.
|
||||
FieldHitGroupGear = "hit_group_gear"
|
||||
// FieldCrosshair holds the string denoting the crosshair field in the database.
|
||||
FieldCrosshair = "crosshair"
|
||||
// FieldColor holds the string denoting the color field in the database.
|
||||
FieldColor = "color"
|
||||
// FieldKast holds the string denoting the kast field in the database.
|
||||
FieldKast = "kast"
|
||||
// FieldFlashDurationSelf holds the string denoting the flash_duration_self field in the database.
|
||||
FieldFlashDurationSelf = "flash_duration_self"
|
||||
// FieldFlashDurationTeam holds the string denoting the flash_duration_team field in the database.
|
||||
FieldFlashDurationTeam = "flash_duration_team"
|
||||
// FieldFlashDurationEnemy holds the string denoting the flash_duration_enemy field in the database.
|
||||
FieldFlashDurationEnemy = "flash_duration_enemy"
|
||||
// FieldFlashTotalSelf holds the string denoting the flash_total_self field in the database.
|
||||
FieldFlashTotalSelf = "flash_total_self"
|
||||
// FieldFlashTotalTeam holds the string denoting the flash_total_team field in the database.
|
||||
FieldFlashTotalTeam = "flash_total_team"
|
||||
// FieldFlashTotalEnemy holds the string denoting the flash_total_enemy field in the database.
|
||||
FieldFlashTotalEnemy = "flash_total_enemy"
|
||||
// FieldMatchStats holds the string denoting the match_stats field in the database.
|
||||
FieldMatchStats = "match_stats"
|
||||
// FieldPlayerStats holds the string denoting the player_stats field in the database.
|
||||
FieldPlayerStats = "player_stats"
|
||||
// EdgeMatches holds the string denoting the matches edge name in mutations.
|
||||
EdgeMatches = "matches"
|
||||
// EdgePlayers holds the string denoting the players edge name in mutations.
|
||||
EdgePlayers = "players"
|
||||
// EdgeWeaponStats holds the string denoting the weapon_stats edge name in mutations.
|
||||
EdgeWeaponStats = "weapon_stats"
|
||||
// Table holds the table name of the stats in the database.
|
||||
Table = "stats"
|
||||
// MatchesTable is the table that holds the matches relation/edge.
|
||||
@@ -43,6 +111,13 @@ const (
|
||||
PlayersInverseTable = "players"
|
||||
// PlayersColumn is the table column denoting the players relation/edge.
|
||||
PlayersColumn = "player_stats"
|
||||
// WeaponStatsTable is the table that holds the weapon_stats relation/edge.
|
||||
WeaponStatsTable = "weapon_stats"
|
||||
// WeaponStatsInverseTable is the table name for the WeaponStats entity.
|
||||
// It exists in this package in order to avoid circular dependency with the "weaponstats" package.
|
||||
WeaponStatsInverseTable = "weapon_stats"
|
||||
// WeaponStatsColumn is the table column denoting the weapon_stats relation/edge.
|
||||
WeaponStatsColumn = "stats_weapon_stats"
|
||||
)
|
||||
|
||||
// Columns holds all SQL columns for stats fields.
|
||||
@@ -55,14 +130,38 @@ var Columns = []string{
|
||||
FieldHeadshot,
|
||||
FieldMvp,
|
||||
FieldScore,
|
||||
FieldExtended,
|
||||
}
|
||||
|
||||
// ForeignKeys holds the SQL foreign-keys that are owned by the "stats"
|
||||
// table and are not defined as standalone fields in the schema.
|
||||
var ForeignKeys = []string{
|
||||
"match_stats",
|
||||
"player_stats",
|
||||
FieldRankNew,
|
||||
FieldRankOld,
|
||||
FieldMk2,
|
||||
FieldMk3,
|
||||
FieldMk4,
|
||||
FieldMk5,
|
||||
FieldDmgEnemy,
|
||||
FieldDmgTeam,
|
||||
FieldUdHe,
|
||||
FieldUdFlames,
|
||||
FieldUdFlash,
|
||||
FieldUdDecoy,
|
||||
FieldUdSmoke,
|
||||
FieldHitGroupHead,
|
||||
FieldHitGroupChest,
|
||||
FieldHitGroupStomach,
|
||||
FieldHitGroupLeftArm,
|
||||
FieldHitGroupRightArm,
|
||||
FieldHitGroupLeftLeg,
|
||||
FieldHitGroupRightLeg,
|
||||
FieldHitGroupGear,
|
||||
FieldCrosshair,
|
||||
FieldColor,
|
||||
FieldKast,
|
||||
FieldFlashDurationSelf,
|
||||
FieldFlashDurationTeam,
|
||||
FieldFlashDurationEnemy,
|
||||
FieldFlashTotalSelf,
|
||||
FieldFlashTotalTeam,
|
||||
FieldFlashTotalEnemy,
|
||||
FieldMatchStats,
|
||||
FieldPlayerStats,
|
||||
}
|
||||
|
||||
// ValidColumn reports if the column name is valid (part of the table columns).
|
||||
@@ -72,10 +171,31 @@ func ValidColumn(column string) bool {
|
||||
return true
|
||||
}
|
||||
}
|
||||
for i := range ForeignKeys {
|
||||
if column == ForeignKeys[i] {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// Color defines the type for the "color" enum field.
|
||||
type Color string
|
||||
|
||||
// Color values.
|
||||
const (
|
||||
ColorGreen Color = "green"
|
||||
ColorYellow Color = "yellow"
|
||||
ColorPurple Color = "purple"
|
||||
ColorBlue Color = "blue"
|
||||
ColorOrange Color = "orange"
|
||||
)
|
||||
|
||||
func (c Color) String() string {
|
||||
return string(c)
|
||||
}
|
||||
|
||||
// ColorValidator is a validator for the "color" field enum values. It is called by the builders before save.
|
||||
func ColorValidator(c Color) error {
|
||||
switch c {
|
||||
case ColorGreen, ColorYellow, ColorPurple, ColorBlue, ColorOrange:
|
||||
return nil
|
||||
default:
|
||||
return fmt.Errorf("stats: invalid enum value for color field: %q", c)
|
||||
}
|
||||
}
|
||||
|
||||
3092
ent/stats/where.go
3092
ent/stats/where.go
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user