[FEATURE] Detailed stats about player weapon usage and hitgroups (#1)
Reviewed-on: https://git.harting.dev/CSGOWTF/csgowtfd/pulls/1 Co-authored-by: Giovanni Harting <539@idlegandalf.com> Co-committed-by: Giovanni Harting <539@idlegandalf.com>
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"csgowtfd/ent/match"
|
||||
"csgowtfd/ent/player"
|
||||
"csgowtfd/ent/stats"
|
||||
"csgowtfd/ent/weaponstats"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
@@ -52,8 +53,8 @@ func (sc *StatsCreate) SetHeadshot(i int) *StatsCreate {
|
||||
}
|
||||
|
||||
// SetMvp sets the "mvp" field.
|
||||
func (sc *StatsCreate) SetMvp(i int) *StatsCreate {
|
||||
sc.mutation.SetMvp(i)
|
||||
func (sc *StatsCreate) SetMvp(u uint) *StatsCreate {
|
||||
sc.mutation.SetMvp(u)
|
||||
return sc
|
||||
}
|
||||
|
||||
@@ -63,110 +64,450 @@ func (sc *StatsCreate) SetScore(i int) *StatsCreate {
|
||||
return sc
|
||||
}
|
||||
|
||||
// SetExtended sets the "extended" field.
|
||||
func (sc *StatsCreate) SetExtended(skkgaaaallllg struct {
|
||||
MultiKills struct {
|
||||
Duo int "json:\"duo,omitempty\""
|
||||
Triple int "json:\"triple,omitempty\""
|
||||
Quad int "json:\"quad,omitempty\""
|
||||
Pent int "json:\"pent,omitempty\""
|
||||
} "json:\"multi_kills,omitempty\""
|
||||
Dmg struct {
|
||||
Enemy int "json:\"enemy,omitempty\""
|
||||
Team int "json:\"team,omitempty\""
|
||||
UD struct {
|
||||
HE int "json:\"he,omitempty\""
|
||||
Flames int "json:\"flames,omitempty\""
|
||||
Flash int "json:\"flash,omitempty\""
|
||||
Decoy int "json:\"decoy,omitempty\""
|
||||
Smoke int "json:\"smoke,omitempty\""
|
||||
} "json:\"ud,omitempty\""
|
||||
HitGroup struct {
|
||||
Head int "json:\"head,omitempty\""
|
||||
Chest int "json:\"chest,omitempty\""
|
||||
Stomach int "json:\"stomach,omitempty\""
|
||||
LeftArm int "json:\"left_arm,omitempty\""
|
||||
RightArm int "json:\"right_arm,omitempty\""
|
||||
LeftLeg int "json:\"left_leg,omitempty\""
|
||||
RightLeg int "json:\"right_leg,omitempty\""
|
||||
Gear int "json:\"gear,omitempty\""
|
||||
} "json:\"hit_group,omitempty\""
|
||||
} "json:\"dmg,omitempty\""
|
||||
Crosshair string "json:\"crosshair,omitempty\""
|
||||
Color string "json:\"color,omitempty\""
|
||||
KAST int "json:\"kast,omitempty\""
|
||||
Rank struct {
|
||||
Old int "json:\"old,omitempty\""
|
||||
New int "json:\"new,omitempty\""
|
||||
} "json:\"rank,omitempty\""
|
||||
Flash struct {
|
||||
Duration struct {
|
||||
Self float32 "json:\"self,omitempty\""
|
||||
Team float32 "json:\"team,omitempty\""
|
||||
Enemy float32 "json:\"enemy,omitempty\""
|
||||
} "json:\"duration,omitempty\""
|
||||
Total struct {
|
||||
Team int "json:\"team,omitempty\""
|
||||
Enemy int "json:\"enemy,omitempty\""
|
||||
Self int "json:\"self,omitempty\""
|
||||
} "json:\"total,omitempty\""
|
||||
} "json:\"flash,omitempty\""
|
||||
}) *StatsCreate {
|
||||
sc.mutation.SetExtended(skkgaaaallllg)
|
||||
// SetRankNew sets the "rank_new" field.
|
||||
func (sc *StatsCreate) SetRankNew(i int) *StatsCreate {
|
||||
sc.mutation.SetRankNew(i)
|
||||
return sc
|
||||
}
|
||||
|
||||
// SetNillableExtended sets the "extended" field if the given value is not nil.
|
||||
func (sc *StatsCreate) SetNillableExtended(skkgaaaallllg *struct {
|
||||
MultiKills struct {
|
||||
Duo int "json:\"duo,omitempty\""
|
||||
Triple int "json:\"triple,omitempty\""
|
||||
Quad int "json:\"quad,omitempty\""
|
||||
Pent int "json:\"pent,omitempty\""
|
||||
} "json:\"multi_kills,omitempty\""
|
||||
Dmg struct {
|
||||
Enemy int "json:\"enemy,omitempty\""
|
||||
Team int "json:\"team,omitempty\""
|
||||
UD struct {
|
||||
HE int "json:\"he,omitempty\""
|
||||
Flames int "json:\"flames,omitempty\""
|
||||
Flash int "json:\"flash,omitempty\""
|
||||
Decoy int "json:\"decoy,omitempty\""
|
||||
Smoke int "json:\"smoke,omitempty\""
|
||||
} "json:\"ud,omitempty\""
|
||||
HitGroup struct {
|
||||
Head int "json:\"head,omitempty\""
|
||||
Chest int "json:\"chest,omitempty\""
|
||||
Stomach int "json:\"stomach,omitempty\""
|
||||
LeftArm int "json:\"left_arm,omitempty\""
|
||||
RightArm int "json:\"right_arm,omitempty\""
|
||||
LeftLeg int "json:\"left_leg,omitempty\""
|
||||
RightLeg int "json:\"right_leg,omitempty\""
|
||||
Gear int "json:\"gear,omitempty\""
|
||||
} "json:\"hit_group,omitempty\""
|
||||
} "json:\"dmg,omitempty\""
|
||||
Crosshair string "json:\"crosshair,omitempty\""
|
||||
Color string "json:\"color,omitempty\""
|
||||
KAST int "json:\"kast,omitempty\""
|
||||
Rank struct {
|
||||
Old int "json:\"old,omitempty\""
|
||||
New int "json:\"new,omitempty\""
|
||||
} "json:\"rank,omitempty\""
|
||||
Flash struct {
|
||||
Duration struct {
|
||||
Self float32 "json:\"self,omitempty\""
|
||||
Team float32 "json:\"team,omitempty\""
|
||||
Enemy float32 "json:\"enemy,omitempty\""
|
||||
} "json:\"duration,omitempty\""
|
||||
Total struct {
|
||||
Team int "json:\"team,omitempty\""
|
||||
Enemy int "json:\"enemy,omitempty\""
|
||||
Self int "json:\"self,omitempty\""
|
||||
} "json:\"total,omitempty\""
|
||||
} "json:\"flash,omitempty\""
|
||||
}) *StatsCreate {
|
||||
if skkgaaaallllg != nil {
|
||||
sc.SetExtended(*skkgaaaallllg)
|
||||
// SetNillableRankNew sets the "rank_new" field if the given value is not nil.
|
||||
func (sc *StatsCreate) SetNillableRankNew(i *int) *StatsCreate {
|
||||
if i != nil {
|
||||
sc.SetRankNew(*i)
|
||||
}
|
||||
return sc
|
||||
}
|
||||
|
||||
// SetRankOld sets the "rank_old" field.
|
||||
func (sc *StatsCreate) SetRankOld(i int) *StatsCreate {
|
||||
sc.mutation.SetRankOld(i)
|
||||
return sc
|
||||
}
|
||||
|
||||
// SetNillableRankOld sets the "rank_old" field if the given value is not nil.
|
||||
func (sc *StatsCreate) SetNillableRankOld(i *int) *StatsCreate {
|
||||
if i != nil {
|
||||
sc.SetRankOld(*i)
|
||||
}
|
||||
return sc
|
||||
}
|
||||
|
||||
// SetMk2 sets the "mk_2" field.
|
||||
func (sc *StatsCreate) SetMk2(u uint) *StatsCreate {
|
||||
sc.mutation.SetMk2(u)
|
||||
return sc
|
||||
}
|
||||
|
||||
// SetNillableMk2 sets the "mk_2" field if the given value is not nil.
|
||||
func (sc *StatsCreate) SetNillableMk2(u *uint) *StatsCreate {
|
||||
if u != nil {
|
||||
sc.SetMk2(*u)
|
||||
}
|
||||
return sc
|
||||
}
|
||||
|
||||
// SetMk3 sets the "mk_3" field.
|
||||
func (sc *StatsCreate) SetMk3(u uint) *StatsCreate {
|
||||
sc.mutation.SetMk3(u)
|
||||
return sc
|
||||
}
|
||||
|
||||
// SetNillableMk3 sets the "mk_3" field if the given value is not nil.
|
||||
func (sc *StatsCreate) SetNillableMk3(u *uint) *StatsCreate {
|
||||
if u != nil {
|
||||
sc.SetMk3(*u)
|
||||
}
|
||||
return sc
|
||||
}
|
||||
|
||||
// SetMk4 sets the "mk_4" field.
|
||||
func (sc *StatsCreate) SetMk4(u uint) *StatsCreate {
|
||||
sc.mutation.SetMk4(u)
|
||||
return sc
|
||||
}
|
||||
|
||||
// SetNillableMk4 sets the "mk_4" field if the given value is not nil.
|
||||
func (sc *StatsCreate) SetNillableMk4(u *uint) *StatsCreate {
|
||||
if u != nil {
|
||||
sc.SetMk4(*u)
|
||||
}
|
||||
return sc
|
||||
}
|
||||
|
||||
// SetMk5 sets the "mk_5" field.
|
||||
func (sc *StatsCreate) SetMk5(u uint) *StatsCreate {
|
||||
sc.mutation.SetMk5(u)
|
||||
return sc
|
||||
}
|
||||
|
||||
// SetNillableMk5 sets the "mk_5" field if the given value is not nil.
|
||||
func (sc *StatsCreate) SetNillableMk5(u *uint) *StatsCreate {
|
||||
if u != nil {
|
||||
sc.SetMk5(*u)
|
||||
}
|
||||
return sc
|
||||
}
|
||||
|
||||
// SetDmgEnemy sets the "dmg_enemy" field.
|
||||
func (sc *StatsCreate) SetDmgEnemy(u uint) *StatsCreate {
|
||||
sc.mutation.SetDmgEnemy(u)
|
||||
return sc
|
||||
}
|
||||
|
||||
// SetNillableDmgEnemy sets the "dmg_enemy" field if the given value is not nil.
|
||||
func (sc *StatsCreate) SetNillableDmgEnemy(u *uint) *StatsCreate {
|
||||
if u != nil {
|
||||
sc.SetDmgEnemy(*u)
|
||||
}
|
||||
return sc
|
||||
}
|
||||
|
||||
// SetDmgTeam sets the "dmg_team" field.
|
||||
func (sc *StatsCreate) SetDmgTeam(u uint) *StatsCreate {
|
||||
sc.mutation.SetDmgTeam(u)
|
||||
return sc
|
||||
}
|
||||
|
||||
// SetNillableDmgTeam sets the "dmg_team" field if the given value is not nil.
|
||||
func (sc *StatsCreate) SetNillableDmgTeam(u *uint) *StatsCreate {
|
||||
if u != nil {
|
||||
sc.SetDmgTeam(*u)
|
||||
}
|
||||
return sc
|
||||
}
|
||||
|
||||
// SetUdHe sets the "ud_he" field.
|
||||
func (sc *StatsCreate) SetUdHe(u uint) *StatsCreate {
|
||||
sc.mutation.SetUdHe(u)
|
||||
return sc
|
||||
}
|
||||
|
||||
// SetNillableUdHe sets the "ud_he" field if the given value is not nil.
|
||||
func (sc *StatsCreate) SetNillableUdHe(u *uint) *StatsCreate {
|
||||
if u != nil {
|
||||
sc.SetUdHe(*u)
|
||||
}
|
||||
return sc
|
||||
}
|
||||
|
||||
// SetUdFlames sets the "ud_flames" field.
|
||||
func (sc *StatsCreate) SetUdFlames(u uint) *StatsCreate {
|
||||
sc.mutation.SetUdFlames(u)
|
||||
return sc
|
||||
}
|
||||
|
||||
// SetNillableUdFlames sets the "ud_flames" field if the given value is not nil.
|
||||
func (sc *StatsCreate) SetNillableUdFlames(u *uint) *StatsCreate {
|
||||
if u != nil {
|
||||
sc.SetUdFlames(*u)
|
||||
}
|
||||
return sc
|
||||
}
|
||||
|
||||
// SetUdFlash sets the "ud_flash" field.
|
||||
func (sc *StatsCreate) SetUdFlash(u uint) *StatsCreate {
|
||||
sc.mutation.SetUdFlash(u)
|
||||
return sc
|
||||
}
|
||||
|
||||
// SetNillableUdFlash sets the "ud_flash" field if the given value is not nil.
|
||||
func (sc *StatsCreate) SetNillableUdFlash(u *uint) *StatsCreate {
|
||||
if u != nil {
|
||||
sc.SetUdFlash(*u)
|
||||
}
|
||||
return sc
|
||||
}
|
||||
|
||||
// SetUdDecoy sets the "ud_decoy" field.
|
||||
func (sc *StatsCreate) SetUdDecoy(u uint) *StatsCreate {
|
||||
sc.mutation.SetUdDecoy(u)
|
||||
return sc
|
||||
}
|
||||
|
||||
// SetNillableUdDecoy sets the "ud_decoy" field if the given value is not nil.
|
||||
func (sc *StatsCreate) SetNillableUdDecoy(u *uint) *StatsCreate {
|
||||
if u != nil {
|
||||
sc.SetUdDecoy(*u)
|
||||
}
|
||||
return sc
|
||||
}
|
||||
|
||||
// SetUdSmoke sets the "ud_smoke" field.
|
||||
func (sc *StatsCreate) SetUdSmoke(u uint) *StatsCreate {
|
||||
sc.mutation.SetUdSmoke(u)
|
||||
return sc
|
||||
}
|
||||
|
||||
// SetNillableUdSmoke sets the "ud_smoke" field if the given value is not nil.
|
||||
func (sc *StatsCreate) SetNillableUdSmoke(u *uint) *StatsCreate {
|
||||
if u != nil {
|
||||
sc.SetUdSmoke(*u)
|
||||
}
|
||||
return sc
|
||||
}
|
||||
|
||||
// SetHitGroupHead sets the "hit_group_head" field.
|
||||
func (sc *StatsCreate) SetHitGroupHead(u uint) *StatsCreate {
|
||||
sc.mutation.SetHitGroupHead(u)
|
||||
return sc
|
||||
}
|
||||
|
||||
// SetNillableHitGroupHead sets the "hit_group_head" field if the given value is not nil.
|
||||
func (sc *StatsCreate) SetNillableHitGroupHead(u *uint) *StatsCreate {
|
||||
if u != nil {
|
||||
sc.SetHitGroupHead(*u)
|
||||
}
|
||||
return sc
|
||||
}
|
||||
|
||||
// SetHitGroupChest sets the "hit_group_chest" field.
|
||||
func (sc *StatsCreate) SetHitGroupChest(u uint) *StatsCreate {
|
||||
sc.mutation.SetHitGroupChest(u)
|
||||
return sc
|
||||
}
|
||||
|
||||
// SetNillableHitGroupChest sets the "hit_group_chest" field if the given value is not nil.
|
||||
func (sc *StatsCreate) SetNillableHitGroupChest(u *uint) *StatsCreate {
|
||||
if u != nil {
|
||||
sc.SetHitGroupChest(*u)
|
||||
}
|
||||
return sc
|
||||
}
|
||||
|
||||
// SetHitGroupStomach sets the "hit_group_stomach" field.
|
||||
func (sc *StatsCreate) SetHitGroupStomach(u uint) *StatsCreate {
|
||||
sc.mutation.SetHitGroupStomach(u)
|
||||
return sc
|
||||
}
|
||||
|
||||
// SetNillableHitGroupStomach sets the "hit_group_stomach" field if the given value is not nil.
|
||||
func (sc *StatsCreate) SetNillableHitGroupStomach(u *uint) *StatsCreate {
|
||||
if u != nil {
|
||||
sc.SetHitGroupStomach(*u)
|
||||
}
|
||||
return sc
|
||||
}
|
||||
|
||||
// SetHitGroupLeftArm sets the "hit_group_left_arm" field.
|
||||
func (sc *StatsCreate) SetHitGroupLeftArm(u uint) *StatsCreate {
|
||||
sc.mutation.SetHitGroupLeftArm(u)
|
||||
return sc
|
||||
}
|
||||
|
||||
// SetNillableHitGroupLeftArm sets the "hit_group_left_arm" field if the given value is not nil.
|
||||
func (sc *StatsCreate) SetNillableHitGroupLeftArm(u *uint) *StatsCreate {
|
||||
if u != nil {
|
||||
sc.SetHitGroupLeftArm(*u)
|
||||
}
|
||||
return sc
|
||||
}
|
||||
|
||||
// SetHitGroupRightArm sets the "hit_group_right_arm" field.
|
||||
func (sc *StatsCreate) SetHitGroupRightArm(u uint) *StatsCreate {
|
||||
sc.mutation.SetHitGroupRightArm(u)
|
||||
return sc
|
||||
}
|
||||
|
||||
// SetNillableHitGroupRightArm sets the "hit_group_right_arm" field if the given value is not nil.
|
||||
func (sc *StatsCreate) SetNillableHitGroupRightArm(u *uint) *StatsCreate {
|
||||
if u != nil {
|
||||
sc.SetHitGroupRightArm(*u)
|
||||
}
|
||||
return sc
|
||||
}
|
||||
|
||||
// SetHitGroupLeftLeg sets the "hit_group_left_leg" field.
|
||||
func (sc *StatsCreate) SetHitGroupLeftLeg(u uint) *StatsCreate {
|
||||
sc.mutation.SetHitGroupLeftLeg(u)
|
||||
return sc
|
||||
}
|
||||
|
||||
// SetNillableHitGroupLeftLeg sets the "hit_group_left_leg" field if the given value is not nil.
|
||||
func (sc *StatsCreate) SetNillableHitGroupLeftLeg(u *uint) *StatsCreate {
|
||||
if u != nil {
|
||||
sc.SetHitGroupLeftLeg(*u)
|
||||
}
|
||||
return sc
|
||||
}
|
||||
|
||||
// SetHitGroupRightLeg sets the "hit_group_right_leg" field.
|
||||
func (sc *StatsCreate) SetHitGroupRightLeg(u uint) *StatsCreate {
|
||||
sc.mutation.SetHitGroupRightLeg(u)
|
||||
return sc
|
||||
}
|
||||
|
||||
// SetNillableHitGroupRightLeg sets the "hit_group_right_leg" field if the given value is not nil.
|
||||
func (sc *StatsCreate) SetNillableHitGroupRightLeg(u *uint) *StatsCreate {
|
||||
if u != nil {
|
||||
sc.SetHitGroupRightLeg(*u)
|
||||
}
|
||||
return sc
|
||||
}
|
||||
|
||||
// SetHitGroupGear sets the "hit_group_gear" field.
|
||||
func (sc *StatsCreate) SetHitGroupGear(u uint) *StatsCreate {
|
||||
sc.mutation.SetHitGroupGear(u)
|
||||
return sc
|
||||
}
|
||||
|
||||
// SetNillableHitGroupGear sets the "hit_group_gear" field if the given value is not nil.
|
||||
func (sc *StatsCreate) SetNillableHitGroupGear(u *uint) *StatsCreate {
|
||||
if u != nil {
|
||||
sc.SetHitGroupGear(*u)
|
||||
}
|
||||
return sc
|
||||
}
|
||||
|
||||
// SetCrosshair sets the "crosshair" field.
|
||||
func (sc *StatsCreate) SetCrosshair(s string) *StatsCreate {
|
||||
sc.mutation.SetCrosshair(s)
|
||||
return sc
|
||||
}
|
||||
|
||||
// SetNillableCrosshair sets the "crosshair" field if the given value is not nil.
|
||||
func (sc *StatsCreate) SetNillableCrosshair(s *string) *StatsCreate {
|
||||
if s != nil {
|
||||
sc.SetCrosshair(*s)
|
||||
}
|
||||
return sc
|
||||
}
|
||||
|
||||
// SetColor sets the "color" field.
|
||||
func (sc *StatsCreate) SetColor(s stats.Color) *StatsCreate {
|
||||
sc.mutation.SetColor(s)
|
||||
return sc
|
||||
}
|
||||
|
||||
// SetNillableColor sets the "color" field if the given value is not nil.
|
||||
func (sc *StatsCreate) SetNillableColor(s *stats.Color) *StatsCreate {
|
||||
if s != nil {
|
||||
sc.SetColor(*s)
|
||||
}
|
||||
return sc
|
||||
}
|
||||
|
||||
// SetKast sets the "kast" field.
|
||||
func (sc *StatsCreate) SetKast(i int) *StatsCreate {
|
||||
sc.mutation.SetKast(i)
|
||||
return sc
|
||||
}
|
||||
|
||||
// SetNillableKast sets the "kast" field if the given value is not nil.
|
||||
func (sc *StatsCreate) SetNillableKast(i *int) *StatsCreate {
|
||||
if i != nil {
|
||||
sc.SetKast(*i)
|
||||
}
|
||||
return sc
|
||||
}
|
||||
|
||||
// SetFlashDurationSelf sets the "flash_duration_self" field.
|
||||
func (sc *StatsCreate) SetFlashDurationSelf(f float32) *StatsCreate {
|
||||
sc.mutation.SetFlashDurationSelf(f)
|
||||
return sc
|
||||
}
|
||||
|
||||
// SetNillableFlashDurationSelf sets the "flash_duration_self" field if the given value is not nil.
|
||||
func (sc *StatsCreate) SetNillableFlashDurationSelf(f *float32) *StatsCreate {
|
||||
if f != nil {
|
||||
sc.SetFlashDurationSelf(*f)
|
||||
}
|
||||
return sc
|
||||
}
|
||||
|
||||
// SetFlashDurationTeam sets the "flash_duration_team" field.
|
||||
func (sc *StatsCreate) SetFlashDurationTeam(f float32) *StatsCreate {
|
||||
sc.mutation.SetFlashDurationTeam(f)
|
||||
return sc
|
||||
}
|
||||
|
||||
// SetNillableFlashDurationTeam sets the "flash_duration_team" field if the given value is not nil.
|
||||
func (sc *StatsCreate) SetNillableFlashDurationTeam(f *float32) *StatsCreate {
|
||||
if f != nil {
|
||||
sc.SetFlashDurationTeam(*f)
|
||||
}
|
||||
return sc
|
||||
}
|
||||
|
||||
// SetFlashDurationEnemy sets the "flash_duration_enemy" field.
|
||||
func (sc *StatsCreate) SetFlashDurationEnemy(f float32) *StatsCreate {
|
||||
sc.mutation.SetFlashDurationEnemy(f)
|
||||
return sc
|
||||
}
|
||||
|
||||
// SetNillableFlashDurationEnemy sets the "flash_duration_enemy" field if the given value is not nil.
|
||||
func (sc *StatsCreate) SetNillableFlashDurationEnemy(f *float32) *StatsCreate {
|
||||
if f != nil {
|
||||
sc.SetFlashDurationEnemy(*f)
|
||||
}
|
||||
return sc
|
||||
}
|
||||
|
||||
// SetFlashTotalSelf sets the "flash_total_self" field.
|
||||
func (sc *StatsCreate) SetFlashTotalSelf(u uint) *StatsCreate {
|
||||
sc.mutation.SetFlashTotalSelf(u)
|
||||
return sc
|
||||
}
|
||||
|
||||
// SetNillableFlashTotalSelf sets the "flash_total_self" field if the given value is not nil.
|
||||
func (sc *StatsCreate) SetNillableFlashTotalSelf(u *uint) *StatsCreate {
|
||||
if u != nil {
|
||||
sc.SetFlashTotalSelf(*u)
|
||||
}
|
||||
return sc
|
||||
}
|
||||
|
||||
// SetFlashTotalTeam sets the "flash_total_team" field.
|
||||
func (sc *StatsCreate) SetFlashTotalTeam(u uint) *StatsCreate {
|
||||
sc.mutation.SetFlashTotalTeam(u)
|
||||
return sc
|
||||
}
|
||||
|
||||
// SetNillableFlashTotalTeam sets the "flash_total_team" field if the given value is not nil.
|
||||
func (sc *StatsCreate) SetNillableFlashTotalTeam(u *uint) *StatsCreate {
|
||||
if u != nil {
|
||||
sc.SetFlashTotalTeam(*u)
|
||||
}
|
||||
return sc
|
||||
}
|
||||
|
||||
// SetFlashTotalEnemy sets the "flash_total_enemy" field.
|
||||
func (sc *StatsCreate) SetFlashTotalEnemy(u uint) *StatsCreate {
|
||||
sc.mutation.SetFlashTotalEnemy(u)
|
||||
return sc
|
||||
}
|
||||
|
||||
// SetNillableFlashTotalEnemy sets the "flash_total_enemy" field if the given value is not nil.
|
||||
func (sc *StatsCreate) SetNillableFlashTotalEnemy(u *uint) *StatsCreate {
|
||||
if u != nil {
|
||||
sc.SetFlashTotalEnemy(*u)
|
||||
}
|
||||
return sc
|
||||
}
|
||||
|
||||
// SetMatchStats sets the "match_stats" field.
|
||||
func (sc *StatsCreate) SetMatchStats(u uint64) *StatsCreate {
|
||||
sc.mutation.SetMatchStats(u)
|
||||
return sc
|
||||
}
|
||||
|
||||
// SetNillableMatchStats sets the "match_stats" field if the given value is not nil.
|
||||
func (sc *StatsCreate) SetNillableMatchStats(u *uint64) *StatsCreate {
|
||||
if u != nil {
|
||||
sc.SetMatchStats(*u)
|
||||
}
|
||||
return sc
|
||||
}
|
||||
|
||||
// SetPlayerStats sets the "player_stats" field.
|
||||
func (sc *StatsCreate) SetPlayerStats(u uint64) *StatsCreate {
|
||||
sc.mutation.SetPlayerStats(u)
|
||||
return sc
|
||||
}
|
||||
|
||||
// SetNillablePlayerStats sets the "player_stats" field if the given value is not nil.
|
||||
func (sc *StatsCreate) SetNillablePlayerStats(u *uint64) *StatsCreate {
|
||||
if u != nil {
|
||||
sc.SetPlayerStats(*u)
|
||||
}
|
||||
return sc
|
||||
}
|
||||
@@ -209,6 +550,21 @@ func (sc *StatsCreate) SetPlayers(p *Player) *StatsCreate {
|
||||
return sc.SetPlayersID(p.ID)
|
||||
}
|
||||
|
||||
// AddWeaponStatIDs adds the "weapon_stats" edge to the WeaponStats entity by IDs.
|
||||
func (sc *StatsCreate) AddWeaponStatIDs(ids ...int) *StatsCreate {
|
||||
sc.mutation.AddWeaponStatIDs(ids...)
|
||||
return sc
|
||||
}
|
||||
|
||||
// AddWeaponStats adds the "weapon_stats" edges to the WeaponStats entity.
|
||||
func (sc *StatsCreate) AddWeaponStats(w ...*WeaponStats) *StatsCreate {
|
||||
ids := make([]int, len(w))
|
||||
for i := range w {
|
||||
ids[i] = w[i].ID
|
||||
}
|
||||
return sc.AddWeaponStatIDs(ids...)
|
||||
}
|
||||
|
||||
// Mutation returns the StatsMutation object of the builder.
|
||||
func (sc *StatsCreate) Mutation() *StatsMutation {
|
||||
return sc.mutation
|
||||
@@ -300,6 +656,11 @@ func (sc *StatsCreate) check() error {
|
||||
if _, ok := sc.mutation.Score(); !ok {
|
||||
return &ValidationError{Name: "score", err: errors.New(`ent: missing required field "score"`)}
|
||||
}
|
||||
if v, ok := sc.mutation.Color(); ok {
|
||||
if err := stats.ColorValidator(v); err != nil {
|
||||
return &ValidationError{Name: "color", err: fmt.Errorf(`ent: validator failed for field "color": %w`, err)}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -369,7 +730,7 @@ func (sc *StatsCreate) createSpec() (*Stats, *sqlgraph.CreateSpec) {
|
||||
}
|
||||
if value, ok := sc.mutation.Mvp(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Type: field.TypeUint,
|
||||
Value: value,
|
||||
Column: stats.FieldMvp,
|
||||
})
|
||||
@@ -383,13 +744,245 @@ func (sc *StatsCreate) createSpec() (*Stats, *sqlgraph.CreateSpec) {
|
||||
})
|
||||
_node.Score = value
|
||||
}
|
||||
if value, ok := sc.mutation.Extended(); ok {
|
||||
if value, ok := sc.mutation.RankNew(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeJSON,
|
||||
Type: field.TypeInt,
|
||||
Value: value,
|
||||
Column: stats.FieldExtended,
|
||||
Column: stats.FieldRankNew,
|
||||
})
|
||||
_node.Extended = value
|
||||
_node.RankNew = value
|
||||
}
|
||||
if value, ok := sc.mutation.RankOld(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Value: value,
|
||||
Column: stats.FieldRankOld,
|
||||
})
|
||||
_node.RankOld = value
|
||||
}
|
||||
if value, ok := sc.mutation.Mk2(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint,
|
||||
Value: value,
|
||||
Column: stats.FieldMk2,
|
||||
})
|
||||
_node.Mk2 = value
|
||||
}
|
||||
if value, ok := sc.mutation.Mk3(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint,
|
||||
Value: value,
|
||||
Column: stats.FieldMk3,
|
||||
})
|
||||
_node.Mk3 = value
|
||||
}
|
||||
if value, ok := sc.mutation.Mk4(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint,
|
||||
Value: value,
|
||||
Column: stats.FieldMk4,
|
||||
})
|
||||
_node.Mk4 = value
|
||||
}
|
||||
if value, ok := sc.mutation.Mk5(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint,
|
||||
Value: value,
|
||||
Column: stats.FieldMk5,
|
||||
})
|
||||
_node.Mk5 = value
|
||||
}
|
||||
if value, ok := sc.mutation.DmgEnemy(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint,
|
||||
Value: value,
|
||||
Column: stats.FieldDmgEnemy,
|
||||
})
|
||||
_node.DmgEnemy = value
|
||||
}
|
||||
if value, ok := sc.mutation.DmgTeam(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint,
|
||||
Value: value,
|
||||
Column: stats.FieldDmgTeam,
|
||||
})
|
||||
_node.DmgTeam = value
|
||||
}
|
||||
if value, ok := sc.mutation.UdHe(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint,
|
||||
Value: value,
|
||||
Column: stats.FieldUdHe,
|
||||
})
|
||||
_node.UdHe = value
|
||||
}
|
||||
if value, ok := sc.mutation.UdFlames(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint,
|
||||
Value: value,
|
||||
Column: stats.FieldUdFlames,
|
||||
})
|
||||
_node.UdFlames = value
|
||||
}
|
||||
if value, ok := sc.mutation.UdFlash(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint,
|
||||
Value: value,
|
||||
Column: stats.FieldUdFlash,
|
||||
})
|
||||
_node.UdFlash = value
|
||||
}
|
||||
if value, ok := sc.mutation.UdDecoy(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint,
|
||||
Value: value,
|
||||
Column: stats.FieldUdDecoy,
|
||||
})
|
||||
_node.UdDecoy = value
|
||||
}
|
||||
if value, ok := sc.mutation.UdSmoke(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint,
|
||||
Value: value,
|
||||
Column: stats.FieldUdSmoke,
|
||||
})
|
||||
_node.UdSmoke = value
|
||||
}
|
||||
if value, ok := sc.mutation.HitGroupHead(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint,
|
||||
Value: value,
|
||||
Column: stats.FieldHitGroupHead,
|
||||
})
|
||||
_node.HitGroupHead = value
|
||||
}
|
||||
if value, ok := sc.mutation.HitGroupChest(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint,
|
||||
Value: value,
|
||||
Column: stats.FieldHitGroupChest,
|
||||
})
|
||||
_node.HitGroupChest = value
|
||||
}
|
||||
if value, ok := sc.mutation.HitGroupStomach(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint,
|
||||
Value: value,
|
||||
Column: stats.FieldHitGroupStomach,
|
||||
})
|
||||
_node.HitGroupStomach = value
|
||||
}
|
||||
if value, ok := sc.mutation.HitGroupLeftArm(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint,
|
||||
Value: value,
|
||||
Column: stats.FieldHitGroupLeftArm,
|
||||
})
|
||||
_node.HitGroupLeftArm = value
|
||||
}
|
||||
if value, ok := sc.mutation.HitGroupRightArm(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint,
|
||||
Value: value,
|
||||
Column: stats.FieldHitGroupRightArm,
|
||||
})
|
||||
_node.HitGroupRightArm = value
|
||||
}
|
||||
if value, ok := sc.mutation.HitGroupLeftLeg(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint,
|
||||
Value: value,
|
||||
Column: stats.FieldHitGroupLeftLeg,
|
||||
})
|
||||
_node.HitGroupLeftLeg = value
|
||||
}
|
||||
if value, ok := sc.mutation.HitGroupRightLeg(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint,
|
||||
Value: value,
|
||||
Column: stats.FieldHitGroupRightLeg,
|
||||
})
|
||||
_node.HitGroupRightLeg = value
|
||||
}
|
||||
if value, ok := sc.mutation.HitGroupGear(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint,
|
||||
Value: value,
|
||||
Column: stats.FieldHitGroupGear,
|
||||
})
|
||||
_node.HitGroupGear = value
|
||||
}
|
||||
if value, ok := sc.mutation.Crosshair(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeString,
|
||||
Value: value,
|
||||
Column: stats.FieldCrosshair,
|
||||
})
|
||||
_node.Crosshair = value
|
||||
}
|
||||
if value, ok := sc.mutation.Color(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeEnum,
|
||||
Value: value,
|
||||
Column: stats.FieldColor,
|
||||
})
|
||||
_node.Color = value
|
||||
}
|
||||
if value, ok := sc.mutation.Kast(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Value: value,
|
||||
Column: stats.FieldKast,
|
||||
})
|
||||
_node.Kast = value
|
||||
}
|
||||
if value, ok := sc.mutation.FlashDurationSelf(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeFloat32,
|
||||
Value: value,
|
||||
Column: stats.FieldFlashDurationSelf,
|
||||
})
|
||||
_node.FlashDurationSelf = value
|
||||
}
|
||||
if value, ok := sc.mutation.FlashDurationTeam(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeFloat32,
|
||||
Value: value,
|
||||
Column: stats.FieldFlashDurationTeam,
|
||||
})
|
||||
_node.FlashDurationTeam = value
|
||||
}
|
||||
if value, ok := sc.mutation.FlashDurationEnemy(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeFloat32,
|
||||
Value: value,
|
||||
Column: stats.FieldFlashDurationEnemy,
|
||||
})
|
||||
_node.FlashDurationEnemy = value
|
||||
}
|
||||
if value, ok := sc.mutation.FlashTotalSelf(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint,
|
||||
Value: value,
|
||||
Column: stats.FieldFlashTotalSelf,
|
||||
})
|
||||
_node.FlashTotalSelf = value
|
||||
}
|
||||
if value, ok := sc.mutation.FlashTotalTeam(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint,
|
||||
Value: value,
|
||||
Column: stats.FieldFlashTotalTeam,
|
||||
})
|
||||
_node.FlashTotalTeam = value
|
||||
}
|
||||
if value, ok := sc.mutation.FlashTotalEnemy(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint,
|
||||
Value: value,
|
||||
Column: stats.FieldFlashTotalEnemy,
|
||||
})
|
||||
_node.FlashTotalEnemy = value
|
||||
}
|
||||
if nodes := sc.mutation.MatchesIDs(); len(nodes) > 0 {
|
||||
edge := &sqlgraph.EdgeSpec{
|
||||
@@ -408,7 +1001,7 @@ func (sc *StatsCreate) createSpec() (*Stats, *sqlgraph.CreateSpec) {
|
||||
for _, k := range nodes {
|
||||
edge.Target.Nodes = append(edge.Target.Nodes, k)
|
||||
}
|
||||
_node.match_stats = &nodes[0]
|
||||
_node.MatchStats = nodes[0]
|
||||
_spec.Edges = append(_spec.Edges, edge)
|
||||
}
|
||||
if nodes := sc.mutation.PlayersIDs(); len(nodes) > 0 {
|
||||
@@ -428,7 +1021,26 @@ func (sc *StatsCreate) createSpec() (*Stats, *sqlgraph.CreateSpec) {
|
||||
for _, k := range nodes {
|
||||
edge.Target.Nodes = append(edge.Target.Nodes, k)
|
||||
}
|
||||
_node.player_stats = &nodes[0]
|
||||
_node.PlayerStats = nodes[0]
|
||||
_spec.Edges = append(_spec.Edges, edge)
|
||||
}
|
||||
if nodes := sc.mutation.WeaponStatsIDs(); len(nodes) > 0 {
|
||||
edge := &sqlgraph.EdgeSpec{
|
||||
Rel: sqlgraph.O2M,
|
||||
Inverse: false,
|
||||
Table: stats.WeaponStatsTable,
|
||||
Columns: []string{stats.WeaponStatsColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: weaponstats.FieldID,
|
||||
},
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
edge.Target.Nodes = append(edge.Target.Nodes, k)
|
||||
}
|
||||
_spec.Edges = append(_spec.Edges, edge)
|
||||
}
|
||||
return _node, _spec
|
||||
|
Reference in New Issue
Block a user