// Code generated by ent, DO NOT EDIT. package ent import ( "context" "errors" "fmt" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" "somegit.dev/csgowtf/csgowtfd/ent/match" "somegit.dev/csgowtf/csgowtfd/ent/matchplayer" "somegit.dev/csgowtf/csgowtfd/ent/messages" "somegit.dev/csgowtf/csgowtfd/ent/player" "somegit.dev/csgowtf/csgowtfd/ent/predicate" "somegit.dev/csgowtf/csgowtfd/ent/roundstats" "somegit.dev/csgowtf/csgowtfd/ent/spray" "somegit.dev/csgowtf/csgowtfd/ent/weapon" ) // MatchPlayerUpdate is the builder for updating MatchPlayer entities. type MatchPlayerUpdate struct { config hooks []Hook mutation *MatchPlayerMutation modifiers []func(*sql.UpdateBuilder) } // Where appends a list predicates to the MatchPlayerUpdate builder. func (mpu *MatchPlayerUpdate) Where(ps ...predicate.MatchPlayer) *MatchPlayerUpdate { mpu.mutation.Where(ps...) return mpu } // SetTeamID sets the "team_id" field. func (mpu *MatchPlayerUpdate) SetTeamID(i int) *MatchPlayerUpdate { mpu.mutation.ResetTeamID() mpu.mutation.SetTeamID(i) return mpu } // AddTeamID adds i to the "team_id" field. func (mpu *MatchPlayerUpdate) AddTeamID(i int) *MatchPlayerUpdate { mpu.mutation.AddTeamID(i) return mpu } // SetKills sets the "kills" field. func (mpu *MatchPlayerUpdate) SetKills(i int) *MatchPlayerUpdate { mpu.mutation.ResetKills() mpu.mutation.SetKills(i) return mpu } // AddKills adds i to the "kills" field. func (mpu *MatchPlayerUpdate) AddKills(i int) *MatchPlayerUpdate { mpu.mutation.AddKills(i) return mpu } // SetDeaths sets the "deaths" field. func (mpu *MatchPlayerUpdate) SetDeaths(i int) *MatchPlayerUpdate { mpu.mutation.ResetDeaths() mpu.mutation.SetDeaths(i) return mpu } // AddDeaths adds i to the "deaths" field. func (mpu *MatchPlayerUpdate) AddDeaths(i int) *MatchPlayerUpdate { mpu.mutation.AddDeaths(i) return mpu } // SetAssists sets the "assists" field. func (mpu *MatchPlayerUpdate) SetAssists(i int) *MatchPlayerUpdate { mpu.mutation.ResetAssists() mpu.mutation.SetAssists(i) return mpu } // AddAssists adds i to the "assists" field. func (mpu *MatchPlayerUpdate) AddAssists(i int) *MatchPlayerUpdate { mpu.mutation.AddAssists(i) return mpu } // SetHeadshot sets the "headshot" field. func (mpu *MatchPlayerUpdate) SetHeadshot(i int) *MatchPlayerUpdate { mpu.mutation.ResetHeadshot() mpu.mutation.SetHeadshot(i) return mpu } // AddHeadshot adds i to the "headshot" field. func (mpu *MatchPlayerUpdate) AddHeadshot(i int) *MatchPlayerUpdate { mpu.mutation.AddHeadshot(i) return mpu } // SetMvp sets the "mvp" field. func (mpu *MatchPlayerUpdate) SetMvp(u uint) *MatchPlayerUpdate { mpu.mutation.ResetMvp() mpu.mutation.SetMvp(u) return mpu } // AddMvp adds u to the "mvp" field. func (mpu *MatchPlayerUpdate) AddMvp(u int) *MatchPlayerUpdate { mpu.mutation.AddMvp(u) return mpu } // SetScore sets the "score" field. func (mpu *MatchPlayerUpdate) SetScore(i int) *MatchPlayerUpdate { mpu.mutation.ResetScore() mpu.mutation.SetScore(i) return mpu } // AddScore adds i to the "score" field. func (mpu *MatchPlayerUpdate) AddScore(i int) *MatchPlayerUpdate { mpu.mutation.AddScore(i) return mpu } // SetRankNew sets the "rank_new" field. func (mpu *MatchPlayerUpdate) SetRankNew(i int) *MatchPlayerUpdate { mpu.mutation.ResetRankNew() mpu.mutation.SetRankNew(i) return mpu } // SetNillableRankNew sets the "rank_new" field if the given value is not nil. func (mpu *MatchPlayerUpdate) SetNillableRankNew(i *int) *MatchPlayerUpdate { if i != nil { mpu.SetRankNew(*i) } return mpu } // AddRankNew adds i to the "rank_new" field. func (mpu *MatchPlayerUpdate) AddRankNew(i int) *MatchPlayerUpdate { mpu.mutation.AddRankNew(i) return mpu } // ClearRankNew clears the value of the "rank_new" field. func (mpu *MatchPlayerUpdate) ClearRankNew() *MatchPlayerUpdate { mpu.mutation.ClearRankNew() return mpu } // SetRankOld sets the "rank_old" field. func (mpu *MatchPlayerUpdate) SetRankOld(i int) *MatchPlayerUpdate { mpu.mutation.ResetRankOld() mpu.mutation.SetRankOld(i) return mpu } // SetNillableRankOld sets the "rank_old" field if the given value is not nil. func (mpu *MatchPlayerUpdate) SetNillableRankOld(i *int) *MatchPlayerUpdate { if i != nil { mpu.SetRankOld(*i) } return mpu } // AddRankOld adds i to the "rank_old" field. func (mpu *MatchPlayerUpdate) AddRankOld(i int) *MatchPlayerUpdate { mpu.mutation.AddRankOld(i) return mpu } // ClearRankOld clears the value of the "rank_old" field. func (mpu *MatchPlayerUpdate) ClearRankOld() *MatchPlayerUpdate { mpu.mutation.ClearRankOld() return mpu } // SetMk2 sets the "mk_2" field. func (mpu *MatchPlayerUpdate) SetMk2(u uint) *MatchPlayerUpdate { mpu.mutation.ResetMk2() mpu.mutation.SetMk2(u) return mpu } // SetNillableMk2 sets the "mk_2" field if the given value is not nil. func (mpu *MatchPlayerUpdate) SetNillableMk2(u *uint) *MatchPlayerUpdate { if u != nil { mpu.SetMk2(*u) } return mpu } // AddMk2 adds u to the "mk_2" field. func (mpu *MatchPlayerUpdate) AddMk2(u int) *MatchPlayerUpdate { mpu.mutation.AddMk2(u) return mpu } // ClearMk2 clears the value of the "mk_2" field. func (mpu *MatchPlayerUpdate) ClearMk2() *MatchPlayerUpdate { mpu.mutation.ClearMk2() return mpu } // SetMk3 sets the "mk_3" field. func (mpu *MatchPlayerUpdate) SetMk3(u uint) *MatchPlayerUpdate { mpu.mutation.ResetMk3() mpu.mutation.SetMk3(u) return mpu } // SetNillableMk3 sets the "mk_3" field if the given value is not nil. func (mpu *MatchPlayerUpdate) SetNillableMk3(u *uint) *MatchPlayerUpdate { if u != nil { mpu.SetMk3(*u) } return mpu } // AddMk3 adds u to the "mk_3" field. func (mpu *MatchPlayerUpdate) AddMk3(u int) *MatchPlayerUpdate { mpu.mutation.AddMk3(u) return mpu } // ClearMk3 clears the value of the "mk_3" field. func (mpu *MatchPlayerUpdate) ClearMk3() *MatchPlayerUpdate { mpu.mutation.ClearMk3() return mpu } // SetMk4 sets the "mk_4" field. func (mpu *MatchPlayerUpdate) SetMk4(u uint) *MatchPlayerUpdate { mpu.mutation.ResetMk4() mpu.mutation.SetMk4(u) return mpu } // SetNillableMk4 sets the "mk_4" field if the given value is not nil. func (mpu *MatchPlayerUpdate) SetNillableMk4(u *uint) *MatchPlayerUpdate { if u != nil { mpu.SetMk4(*u) } return mpu } // AddMk4 adds u to the "mk_4" field. func (mpu *MatchPlayerUpdate) AddMk4(u int) *MatchPlayerUpdate { mpu.mutation.AddMk4(u) return mpu } // ClearMk4 clears the value of the "mk_4" field. func (mpu *MatchPlayerUpdate) ClearMk4() *MatchPlayerUpdate { mpu.mutation.ClearMk4() return mpu } // SetMk5 sets the "mk_5" field. func (mpu *MatchPlayerUpdate) SetMk5(u uint) *MatchPlayerUpdate { mpu.mutation.ResetMk5() mpu.mutation.SetMk5(u) return mpu } // SetNillableMk5 sets the "mk_5" field if the given value is not nil. func (mpu *MatchPlayerUpdate) SetNillableMk5(u *uint) *MatchPlayerUpdate { if u != nil { mpu.SetMk5(*u) } return mpu } // AddMk5 adds u to the "mk_5" field. func (mpu *MatchPlayerUpdate) AddMk5(u int) *MatchPlayerUpdate { mpu.mutation.AddMk5(u) return mpu } // ClearMk5 clears the value of the "mk_5" field. func (mpu *MatchPlayerUpdate) ClearMk5() *MatchPlayerUpdate { mpu.mutation.ClearMk5() return mpu } // SetDmgEnemy sets the "dmg_enemy" field. func (mpu *MatchPlayerUpdate) SetDmgEnemy(u uint) *MatchPlayerUpdate { mpu.mutation.ResetDmgEnemy() mpu.mutation.SetDmgEnemy(u) return mpu } // SetNillableDmgEnemy sets the "dmg_enemy" field if the given value is not nil. func (mpu *MatchPlayerUpdate) SetNillableDmgEnemy(u *uint) *MatchPlayerUpdate { if u != nil { mpu.SetDmgEnemy(*u) } return mpu } // AddDmgEnemy adds u to the "dmg_enemy" field. func (mpu *MatchPlayerUpdate) AddDmgEnemy(u int) *MatchPlayerUpdate { mpu.mutation.AddDmgEnemy(u) return mpu } // ClearDmgEnemy clears the value of the "dmg_enemy" field. func (mpu *MatchPlayerUpdate) ClearDmgEnemy() *MatchPlayerUpdate { mpu.mutation.ClearDmgEnemy() return mpu } // SetDmgTeam sets the "dmg_team" field. func (mpu *MatchPlayerUpdate) SetDmgTeam(u uint) *MatchPlayerUpdate { mpu.mutation.ResetDmgTeam() mpu.mutation.SetDmgTeam(u) return mpu } // SetNillableDmgTeam sets the "dmg_team" field if the given value is not nil. func (mpu *MatchPlayerUpdate) SetNillableDmgTeam(u *uint) *MatchPlayerUpdate { if u != nil { mpu.SetDmgTeam(*u) } return mpu } // AddDmgTeam adds u to the "dmg_team" field. func (mpu *MatchPlayerUpdate) AddDmgTeam(u int) *MatchPlayerUpdate { mpu.mutation.AddDmgTeam(u) return mpu } // ClearDmgTeam clears the value of the "dmg_team" field. func (mpu *MatchPlayerUpdate) ClearDmgTeam() *MatchPlayerUpdate { mpu.mutation.ClearDmgTeam() return mpu } // SetUdHe sets the "ud_he" field. func (mpu *MatchPlayerUpdate) SetUdHe(u uint) *MatchPlayerUpdate { mpu.mutation.ResetUdHe() mpu.mutation.SetUdHe(u) return mpu } // SetNillableUdHe sets the "ud_he" field if the given value is not nil. func (mpu *MatchPlayerUpdate) SetNillableUdHe(u *uint) *MatchPlayerUpdate { if u != nil { mpu.SetUdHe(*u) } return mpu } // AddUdHe adds u to the "ud_he" field. func (mpu *MatchPlayerUpdate) AddUdHe(u int) *MatchPlayerUpdate { mpu.mutation.AddUdHe(u) return mpu } // ClearUdHe clears the value of the "ud_he" field. func (mpu *MatchPlayerUpdate) ClearUdHe() *MatchPlayerUpdate { mpu.mutation.ClearUdHe() return mpu } // SetUdFlames sets the "ud_flames" field. func (mpu *MatchPlayerUpdate) SetUdFlames(u uint) *MatchPlayerUpdate { mpu.mutation.ResetUdFlames() mpu.mutation.SetUdFlames(u) return mpu } // SetNillableUdFlames sets the "ud_flames" field if the given value is not nil. func (mpu *MatchPlayerUpdate) SetNillableUdFlames(u *uint) *MatchPlayerUpdate { if u != nil { mpu.SetUdFlames(*u) } return mpu } // AddUdFlames adds u to the "ud_flames" field. func (mpu *MatchPlayerUpdate) AddUdFlames(u int) *MatchPlayerUpdate { mpu.mutation.AddUdFlames(u) return mpu } // ClearUdFlames clears the value of the "ud_flames" field. func (mpu *MatchPlayerUpdate) ClearUdFlames() *MatchPlayerUpdate { mpu.mutation.ClearUdFlames() return mpu } // SetUdFlash sets the "ud_flash" field. func (mpu *MatchPlayerUpdate) SetUdFlash(u uint) *MatchPlayerUpdate { mpu.mutation.ResetUdFlash() mpu.mutation.SetUdFlash(u) return mpu } // SetNillableUdFlash sets the "ud_flash" field if the given value is not nil. func (mpu *MatchPlayerUpdate) SetNillableUdFlash(u *uint) *MatchPlayerUpdate { if u != nil { mpu.SetUdFlash(*u) } return mpu } // AddUdFlash adds u to the "ud_flash" field. func (mpu *MatchPlayerUpdate) AddUdFlash(u int) *MatchPlayerUpdate { mpu.mutation.AddUdFlash(u) return mpu } // ClearUdFlash clears the value of the "ud_flash" field. func (mpu *MatchPlayerUpdate) ClearUdFlash() *MatchPlayerUpdate { mpu.mutation.ClearUdFlash() return mpu } // SetUdDecoy sets the "ud_decoy" field. func (mpu *MatchPlayerUpdate) SetUdDecoy(u uint) *MatchPlayerUpdate { mpu.mutation.ResetUdDecoy() mpu.mutation.SetUdDecoy(u) return mpu } // SetNillableUdDecoy sets the "ud_decoy" field if the given value is not nil. func (mpu *MatchPlayerUpdate) SetNillableUdDecoy(u *uint) *MatchPlayerUpdate { if u != nil { mpu.SetUdDecoy(*u) } return mpu } // AddUdDecoy adds u to the "ud_decoy" field. func (mpu *MatchPlayerUpdate) AddUdDecoy(u int) *MatchPlayerUpdate { mpu.mutation.AddUdDecoy(u) return mpu } // ClearUdDecoy clears the value of the "ud_decoy" field. func (mpu *MatchPlayerUpdate) ClearUdDecoy() *MatchPlayerUpdate { mpu.mutation.ClearUdDecoy() return mpu } // SetUdSmoke sets the "ud_smoke" field. func (mpu *MatchPlayerUpdate) SetUdSmoke(u uint) *MatchPlayerUpdate { mpu.mutation.ResetUdSmoke() mpu.mutation.SetUdSmoke(u) return mpu } // SetNillableUdSmoke sets the "ud_smoke" field if the given value is not nil. func (mpu *MatchPlayerUpdate) SetNillableUdSmoke(u *uint) *MatchPlayerUpdate { if u != nil { mpu.SetUdSmoke(*u) } return mpu } // AddUdSmoke adds u to the "ud_smoke" field. func (mpu *MatchPlayerUpdate) AddUdSmoke(u int) *MatchPlayerUpdate { mpu.mutation.AddUdSmoke(u) return mpu } // ClearUdSmoke clears the value of the "ud_smoke" field. func (mpu *MatchPlayerUpdate) ClearUdSmoke() *MatchPlayerUpdate { mpu.mutation.ClearUdSmoke() return mpu } // SetCrosshair sets the "crosshair" field. func (mpu *MatchPlayerUpdate) SetCrosshair(s string) *MatchPlayerUpdate { mpu.mutation.SetCrosshair(s) return mpu } // SetNillableCrosshair sets the "crosshair" field if the given value is not nil. func (mpu *MatchPlayerUpdate) SetNillableCrosshair(s *string) *MatchPlayerUpdate { if s != nil { mpu.SetCrosshair(*s) } return mpu } // ClearCrosshair clears the value of the "crosshair" field. func (mpu *MatchPlayerUpdate) ClearCrosshair() *MatchPlayerUpdate { mpu.mutation.ClearCrosshair() return mpu } // SetColor sets the "color" field. func (mpu *MatchPlayerUpdate) SetColor(m matchplayer.Color) *MatchPlayerUpdate { mpu.mutation.SetColor(m) return mpu } // SetNillableColor sets the "color" field if the given value is not nil. func (mpu *MatchPlayerUpdate) SetNillableColor(m *matchplayer.Color) *MatchPlayerUpdate { if m != nil { mpu.SetColor(*m) } return mpu } // ClearColor clears the value of the "color" field. func (mpu *MatchPlayerUpdate) ClearColor() *MatchPlayerUpdate { mpu.mutation.ClearColor() return mpu } // SetKast sets the "kast" field. func (mpu *MatchPlayerUpdate) SetKast(i int) *MatchPlayerUpdate { mpu.mutation.ResetKast() mpu.mutation.SetKast(i) return mpu } // SetNillableKast sets the "kast" field if the given value is not nil. func (mpu *MatchPlayerUpdate) SetNillableKast(i *int) *MatchPlayerUpdate { if i != nil { mpu.SetKast(*i) } return mpu } // AddKast adds i to the "kast" field. func (mpu *MatchPlayerUpdate) AddKast(i int) *MatchPlayerUpdate { mpu.mutation.AddKast(i) return mpu } // ClearKast clears the value of the "kast" field. func (mpu *MatchPlayerUpdate) ClearKast() *MatchPlayerUpdate { mpu.mutation.ClearKast() return mpu } // SetFlashDurationSelf sets the "flash_duration_self" field. func (mpu *MatchPlayerUpdate) SetFlashDurationSelf(f float32) *MatchPlayerUpdate { mpu.mutation.ResetFlashDurationSelf() mpu.mutation.SetFlashDurationSelf(f) return mpu } // SetNillableFlashDurationSelf sets the "flash_duration_self" field if the given value is not nil. func (mpu *MatchPlayerUpdate) SetNillableFlashDurationSelf(f *float32) *MatchPlayerUpdate { if f != nil { mpu.SetFlashDurationSelf(*f) } return mpu } // AddFlashDurationSelf adds f to the "flash_duration_self" field. func (mpu *MatchPlayerUpdate) AddFlashDurationSelf(f float32) *MatchPlayerUpdate { mpu.mutation.AddFlashDurationSelf(f) return mpu } // ClearFlashDurationSelf clears the value of the "flash_duration_self" field. func (mpu *MatchPlayerUpdate) ClearFlashDurationSelf() *MatchPlayerUpdate { mpu.mutation.ClearFlashDurationSelf() return mpu } // SetFlashDurationTeam sets the "flash_duration_team" field. func (mpu *MatchPlayerUpdate) SetFlashDurationTeam(f float32) *MatchPlayerUpdate { mpu.mutation.ResetFlashDurationTeam() mpu.mutation.SetFlashDurationTeam(f) return mpu } // SetNillableFlashDurationTeam sets the "flash_duration_team" field if the given value is not nil. func (mpu *MatchPlayerUpdate) SetNillableFlashDurationTeam(f *float32) *MatchPlayerUpdate { if f != nil { mpu.SetFlashDurationTeam(*f) } return mpu } // AddFlashDurationTeam adds f to the "flash_duration_team" field. func (mpu *MatchPlayerUpdate) AddFlashDurationTeam(f float32) *MatchPlayerUpdate { mpu.mutation.AddFlashDurationTeam(f) return mpu } // ClearFlashDurationTeam clears the value of the "flash_duration_team" field. func (mpu *MatchPlayerUpdate) ClearFlashDurationTeam() *MatchPlayerUpdate { mpu.mutation.ClearFlashDurationTeam() return mpu } // SetFlashDurationEnemy sets the "flash_duration_enemy" field. func (mpu *MatchPlayerUpdate) SetFlashDurationEnemy(f float32) *MatchPlayerUpdate { mpu.mutation.ResetFlashDurationEnemy() mpu.mutation.SetFlashDurationEnemy(f) return mpu } // SetNillableFlashDurationEnemy sets the "flash_duration_enemy" field if the given value is not nil. func (mpu *MatchPlayerUpdate) SetNillableFlashDurationEnemy(f *float32) *MatchPlayerUpdate { if f != nil { mpu.SetFlashDurationEnemy(*f) } return mpu } // AddFlashDurationEnemy adds f to the "flash_duration_enemy" field. func (mpu *MatchPlayerUpdate) AddFlashDurationEnemy(f float32) *MatchPlayerUpdate { mpu.mutation.AddFlashDurationEnemy(f) return mpu } // ClearFlashDurationEnemy clears the value of the "flash_duration_enemy" field. func (mpu *MatchPlayerUpdate) ClearFlashDurationEnemy() *MatchPlayerUpdate { mpu.mutation.ClearFlashDurationEnemy() return mpu } // SetFlashTotalSelf sets the "flash_total_self" field. func (mpu *MatchPlayerUpdate) SetFlashTotalSelf(u uint) *MatchPlayerUpdate { mpu.mutation.ResetFlashTotalSelf() mpu.mutation.SetFlashTotalSelf(u) return mpu } // SetNillableFlashTotalSelf sets the "flash_total_self" field if the given value is not nil. func (mpu *MatchPlayerUpdate) SetNillableFlashTotalSelf(u *uint) *MatchPlayerUpdate { if u != nil { mpu.SetFlashTotalSelf(*u) } return mpu } // AddFlashTotalSelf adds u to the "flash_total_self" field. func (mpu *MatchPlayerUpdate) AddFlashTotalSelf(u int) *MatchPlayerUpdate { mpu.mutation.AddFlashTotalSelf(u) return mpu } // ClearFlashTotalSelf clears the value of the "flash_total_self" field. func (mpu *MatchPlayerUpdate) ClearFlashTotalSelf() *MatchPlayerUpdate { mpu.mutation.ClearFlashTotalSelf() return mpu } // SetFlashTotalTeam sets the "flash_total_team" field. func (mpu *MatchPlayerUpdate) SetFlashTotalTeam(u uint) *MatchPlayerUpdate { mpu.mutation.ResetFlashTotalTeam() mpu.mutation.SetFlashTotalTeam(u) return mpu } // SetNillableFlashTotalTeam sets the "flash_total_team" field if the given value is not nil. func (mpu *MatchPlayerUpdate) SetNillableFlashTotalTeam(u *uint) *MatchPlayerUpdate { if u != nil { mpu.SetFlashTotalTeam(*u) } return mpu } // AddFlashTotalTeam adds u to the "flash_total_team" field. func (mpu *MatchPlayerUpdate) AddFlashTotalTeam(u int) *MatchPlayerUpdate { mpu.mutation.AddFlashTotalTeam(u) return mpu } // ClearFlashTotalTeam clears the value of the "flash_total_team" field. func (mpu *MatchPlayerUpdate) ClearFlashTotalTeam() *MatchPlayerUpdate { mpu.mutation.ClearFlashTotalTeam() return mpu } // SetFlashTotalEnemy sets the "flash_total_enemy" field. func (mpu *MatchPlayerUpdate) SetFlashTotalEnemy(u uint) *MatchPlayerUpdate { mpu.mutation.ResetFlashTotalEnemy() mpu.mutation.SetFlashTotalEnemy(u) return mpu } // SetNillableFlashTotalEnemy sets the "flash_total_enemy" field if the given value is not nil. func (mpu *MatchPlayerUpdate) SetNillableFlashTotalEnemy(u *uint) *MatchPlayerUpdate { if u != nil { mpu.SetFlashTotalEnemy(*u) } return mpu } // AddFlashTotalEnemy adds u to the "flash_total_enemy" field. func (mpu *MatchPlayerUpdate) AddFlashTotalEnemy(u int) *MatchPlayerUpdate { mpu.mutation.AddFlashTotalEnemy(u) return mpu } // ClearFlashTotalEnemy clears the value of the "flash_total_enemy" field. func (mpu *MatchPlayerUpdate) ClearFlashTotalEnemy() *MatchPlayerUpdate { mpu.mutation.ClearFlashTotalEnemy() return mpu } // SetMatchStats sets the "match_stats" field. func (mpu *MatchPlayerUpdate) SetMatchStats(u uint64) *MatchPlayerUpdate { mpu.mutation.SetMatchStats(u) return mpu } // SetNillableMatchStats sets the "match_stats" field if the given value is not nil. func (mpu *MatchPlayerUpdate) SetNillableMatchStats(u *uint64) *MatchPlayerUpdate { if u != nil { mpu.SetMatchStats(*u) } return mpu } // ClearMatchStats clears the value of the "match_stats" field. func (mpu *MatchPlayerUpdate) ClearMatchStats() *MatchPlayerUpdate { mpu.mutation.ClearMatchStats() return mpu } // SetPlayerStats sets the "player_stats" field. func (mpu *MatchPlayerUpdate) SetPlayerStats(u uint64) *MatchPlayerUpdate { mpu.mutation.SetPlayerStats(u) return mpu } // SetNillablePlayerStats sets the "player_stats" field if the given value is not nil. func (mpu *MatchPlayerUpdate) SetNillablePlayerStats(u *uint64) *MatchPlayerUpdate { if u != nil { mpu.SetPlayerStats(*u) } return mpu } // ClearPlayerStats clears the value of the "player_stats" field. func (mpu *MatchPlayerUpdate) ClearPlayerStats() *MatchPlayerUpdate { mpu.mutation.ClearPlayerStats() return mpu } // SetFlashAssists sets the "flash_assists" field. func (mpu *MatchPlayerUpdate) SetFlashAssists(i int) *MatchPlayerUpdate { mpu.mutation.ResetFlashAssists() mpu.mutation.SetFlashAssists(i) return mpu } // SetNillableFlashAssists sets the "flash_assists" field if the given value is not nil. func (mpu *MatchPlayerUpdate) SetNillableFlashAssists(i *int) *MatchPlayerUpdate { if i != nil { mpu.SetFlashAssists(*i) } return mpu } // AddFlashAssists adds i to the "flash_assists" field. func (mpu *MatchPlayerUpdate) AddFlashAssists(i int) *MatchPlayerUpdate { mpu.mutation.AddFlashAssists(i) return mpu } // ClearFlashAssists clears the value of the "flash_assists" field. func (mpu *MatchPlayerUpdate) ClearFlashAssists() *MatchPlayerUpdate { mpu.mutation.ClearFlashAssists() return mpu } // SetAvgPing sets the "avg_ping" field. func (mpu *MatchPlayerUpdate) SetAvgPing(f float64) *MatchPlayerUpdate { mpu.mutation.ResetAvgPing() mpu.mutation.SetAvgPing(f) return mpu } // SetNillableAvgPing sets the "avg_ping" field if the given value is not nil. func (mpu *MatchPlayerUpdate) SetNillableAvgPing(f *float64) *MatchPlayerUpdate { if f != nil { mpu.SetAvgPing(*f) } return mpu } // AddAvgPing adds f to the "avg_ping" field. func (mpu *MatchPlayerUpdate) AddAvgPing(f float64) *MatchPlayerUpdate { mpu.mutation.AddAvgPing(f) return mpu } // ClearAvgPing clears the value of the "avg_ping" field. func (mpu *MatchPlayerUpdate) ClearAvgPing() *MatchPlayerUpdate { mpu.mutation.ClearAvgPing() return mpu } // SetMatchesID sets the "matches" edge to the Match entity by ID. func (mpu *MatchPlayerUpdate) SetMatchesID(id uint64) *MatchPlayerUpdate { mpu.mutation.SetMatchesID(id) return mpu } // SetNillableMatchesID sets the "matches" edge to the Match entity by ID if the given value is not nil. func (mpu *MatchPlayerUpdate) SetNillableMatchesID(id *uint64) *MatchPlayerUpdate { if id != nil { mpu = mpu.SetMatchesID(*id) } return mpu } // SetMatches sets the "matches" edge to the Match entity. func (mpu *MatchPlayerUpdate) SetMatches(m *Match) *MatchPlayerUpdate { return mpu.SetMatchesID(m.ID) } // SetPlayersID sets the "players" edge to the Player entity by ID. func (mpu *MatchPlayerUpdate) SetPlayersID(id uint64) *MatchPlayerUpdate { mpu.mutation.SetPlayersID(id) return mpu } // SetNillablePlayersID sets the "players" edge to the Player entity by ID if the given value is not nil. func (mpu *MatchPlayerUpdate) SetNillablePlayersID(id *uint64) *MatchPlayerUpdate { if id != nil { mpu = mpu.SetPlayersID(*id) } return mpu } // SetPlayers sets the "players" edge to the Player entity. func (mpu *MatchPlayerUpdate) SetPlayers(p *Player) *MatchPlayerUpdate { return mpu.SetPlayersID(p.ID) } // AddWeaponStatIDs adds the "weapon_stats" edge to the Weapon entity by IDs. func (mpu *MatchPlayerUpdate) AddWeaponStatIDs(ids ...int) *MatchPlayerUpdate { mpu.mutation.AddWeaponStatIDs(ids...) return mpu } // AddWeaponStats adds the "weapon_stats" edges to the Weapon entity. func (mpu *MatchPlayerUpdate) AddWeaponStats(w ...*Weapon) *MatchPlayerUpdate { ids := make([]int, len(w)) for i := range w { ids[i] = w[i].ID } return mpu.AddWeaponStatIDs(ids...) } // AddRoundStatIDs adds the "round_stats" edge to the RoundStats entity by IDs. func (mpu *MatchPlayerUpdate) AddRoundStatIDs(ids ...int) *MatchPlayerUpdate { mpu.mutation.AddRoundStatIDs(ids...) return mpu } // AddRoundStats adds the "round_stats" edges to the RoundStats entity. func (mpu *MatchPlayerUpdate) AddRoundStats(r ...*RoundStats) *MatchPlayerUpdate { ids := make([]int, len(r)) for i := range r { ids[i] = r[i].ID } return mpu.AddRoundStatIDs(ids...) } // AddSprayIDs adds the "spray" edge to the Spray entity by IDs. func (mpu *MatchPlayerUpdate) AddSprayIDs(ids ...int) *MatchPlayerUpdate { mpu.mutation.AddSprayIDs(ids...) return mpu } // AddSpray adds the "spray" edges to the Spray entity. func (mpu *MatchPlayerUpdate) AddSpray(s ...*Spray) *MatchPlayerUpdate { ids := make([]int, len(s)) for i := range s { ids[i] = s[i].ID } return mpu.AddSprayIDs(ids...) } // AddMessageIDs adds the "messages" edge to the Messages entity by IDs. func (mpu *MatchPlayerUpdate) AddMessageIDs(ids ...int) *MatchPlayerUpdate { mpu.mutation.AddMessageIDs(ids...) return mpu } // AddMessages adds the "messages" edges to the Messages entity. func (mpu *MatchPlayerUpdate) AddMessages(m ...*Messages) *MatchPlayerUpdate { ids := make([]int, len(m)) for i := range m { ids[i] = m[i].ID } return mpu.AddMessageIDs(ids...) } // Mutation returns the MatchPlayerMutation object of the builder. func (mpu *MatchPlayerUpdate) Mutation() *MatchPlayerMutation { return mpu.mutation } // ClearMatches clears the "matches" edge to the Match entity. func (mpu *MatchPlayerUpdate) ClearMatches() *MatchPlayerUpdate { mpu.mutation.ClearMatches() return mpu } // ClearPlayers clears the "players" edge to the Player entity. func (mpu *MatchPlayerUpdate) ClearPlayers() *MatchPlayerUpdate { mpu.mutation.ClearPlayers() return mpu } // ClearWeaponStats clears all "weapon_stats" edges to the Weapon entity. func (mpu *MatchPlayerUpdate) ClearWeaponStats() *MatchPlayerUpdate { mpu.mutation.ClearWeaponStats() return mpu } // RemoveWeaponStatIDs removes the "weapon_stats" edge to Weapon entities by IDs. func (mpu *MatchPlayerUpdate) RemoveWeaponStatIDs(ids ...int) *MatchPlayerUpdate { mpu.mutation.RemoveWeaponStatIDs(ids...) return mpu } // RemoveWeaponStats removes "weapon_stats" edges to Weapon entities. func (mpu *MatchPlayerUpdate) RemoveWeaponStats(w ...*Weapon) *MatchPlayerUpdate { ids := make([]int, len(w)) for i := range w { ids[i] = w[i].ID } return mpu.RemoveWeaponStatIDs(ids...) } // ClearRoundStats clears all "round_stats" edges to the RoundStats entity. func (mpu *MatchPlayerUpdate) ClearRoundStats() *MatchPlayerUpdate { mpu.mutation.ClearRoundStats() return mpu } // RemoveRoundStatIDs removes the "round_stats" edge to RoundStats entities by IDs. func (mpu *MatchPlayerUpdate) RemoveRoundStatIDs(ids ...int) *MatchPlayerUpdate { mpu.mutation.RemoveRoundStatIDs(ids...) return mpu } // RemoveRoundStats removes "round_stats" edges to RoundStats entities. func (mpu *MatchPlayerUpdate) RemoveRoundStats(r ...*RoundStats) *MatchPlayerUpdate { ids := make([]int, len(r)) for i := range r { ids[i] = r[i].ID } return mpu.RemoveRoundStatIDs(ids...) } // ClearSpray clears all "spray" edges to the Spray entity. func (mpu *MatchPlayerUpdate) ClearSpray() *MatchPlayerUpdate { mpu.mutation.ClearSpray() return mpu } // RemoveSprayIDs removes the "spray" edge to Spray entities by IDs. func (mpu *MatchPlayerUpdate) RemoveSprayIDs(ids ...int) *MatchPlayerUpdate { mpu.mutation.RemoveSprayIDs(ids...) return mpu } // RemoveSpray removes "spray" edges to Spray entities. func (mpu *MatchPlayerUpdate) RemoveSpray(s ...*Spray) *MatchPlayerUpdate { ids := make([]int, len(s)) for i := range s { ids[i] = s[i].ID } return mpu.RemoveSprayIDs(ids...) } // ClearMessages clears all "messages" edges to the Messages entity. func (mpu *MatchPlayerUpdate) ClearMessages() *MatchPlayerUpdate { mpu.mutation.ClearMessages() return mpu } // RemoveMessageIDs removes the "messages" edge to Messages entities by IDs. func (mpu *MatchPlayerUpdate) RemoveMessageIDs(ids ...int) *MatchPlayerUpdate { mpu.mutation.RemoveMessageIDs(ids...) return mpu } // RemoveMessages removes "messages" edges to Messages entities. func (mpu *MatchPlayerUpdate) RemoveMessages(m ...*Messages) *MatchPlayerUpdate { ids := make([]int, len(m)) for i := range m { ids[i] = m[i].ID } return mpu.RemoveMessageIDs(ids...) } // Save executes the query and returns the number of nodes affected by the update operation. func (mpu *MatchPlayerUpdate) Save(ctx context.Context) (int, error) { return withHooks[int, MatchPlayerMutation](ctx, mpu.sqlSave, mpu.mutation, mpu.hooks) } // SaveX is like Save, but panics if an error occurs. func (mpu *MatchPlayerUpdate) SaveX(ctx context.Context) int { affected, err := mpu.Save(ctx) if err != nil { panic(err) } return affected } // Exec executes the query. func (mpu *MatchPlayerUpdate) Exec(ctx context.Context) error { _, err := mpu.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. func (mpu *MatchPlayerUpdate) ExecX(ctx context.Context) { if err := mpu.Exec(ctx); err != nil { panic(err) } } // check runs all checks and user-defined validators on the builder. func (mpu *MatchPlayerUpdate) check() error { if v, ok := mpu.mutation.Color(); ok { if err := matchplayer.ColorValidator(v); err != nil { return &ValidationError{Name: "color", err: fmt.Errorf(`ent: validator failed for field "MatchPlayer.color": %w`, err)} } } return nil } // Modify adds a statement modifier for attaching custom logic to the UPDATE statement. func (mpu *MatchPlayerUpdate) Modify(modifiers ...func(u *sql.UpdateBuilder)) *MatchPlayerUpdate { mpu.modifiers = append(mpu.modifiers, modifiers...) return mpu } func (mpu *MatchPlayerUpdate) sqlSave(ctx context.Context) (n int, err error) { if err := mpu.check(); err != nil { return n, err } _spec := sqlgraph.NewUpdateSpec(matchplayer.Table, matchplayer.Columns, sqlgraph.NewFieldSpec(matchplayer.FieldID, field.TypeInt)) if ps := mpu.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } if value, ok := mpu.mutation.TeamID(); ok { _spec.SetField(matchplayer.FieldTeamID, field.TypeInt, value) } if value, ok := mpu.mutation.AddedTeamID(); ok { _spec.AddField(matchplayer.FieldTeamID, field.TypeInt, value) } if value, ok := mpu.mutation.Kills(); ok { _spec.SetField(matchplayer.FieldKills, field.TypeInt, value) } if value, ok := mpu.mutation.AddedKills(); ok { _spec.AddField(matchplayer.FieldKills, field.TypeInt, value) } if value, ok := mpu.mutation.Deaths(); ok { _spec.SetField(matchplayer.FieldDeaths, field.TypeInt, value) } if value, ok := mpu.mutation.AddedDeaths(); ok { _spec.AddField(matchplayer.FieldDeaths, field.TypeInt, value) } if value, ok := mpu.mutation.Assists(); ok { _spec.SetField(matchplayer.FieldAssists, field.TypeInt, value) } if value, ok := mpu.mutation.AddedAssists(); ok { _spec.AddField(matchplayer.FieldAssists, field.TypeInt, value) } if value, ok := mpu.mutation.Headshot(); ok { _spec.SetField(matchplayer.FieldHeadshot, field.TypeInt, value) } if value, ok := mpu.mutation.AddedHeadshot(); ok { _spec.AddField(matchplayer.FieldHeadshot, field.TypeInt, value) } if value, ok := mpu.mutation.Mvp(); ok { _spec.SetField(matchplayer.FieldMvp, field.TypeUint, value) } if value, ok := mpu.mutation.AddedMvp(); ok { _spec.AddField(matchplayer.FieldMvp, field.TypeUint, value) } if value, ok := mpu.mutation.Score(); ok { _spec.SetField(matchplayer.FieldScore, field.TypeInt, value) } if value, ok := mpu.mutation.AddedScore(); ok { _spec.AddField(matchplayer.FieldScore, field.TypeInt, value) } if value, ok := mpu.mutation.RankNew(); ok { _spec.SetField(matchplayer.FieldRankNew, field.TypeInt, value) } if value, ok := mpu.mutation.AddedRankNew(); ok { _spec.AddField(matchplayer.FieldRankNew, field.TypeInt, value) } if mpu.mutation.RankNewCleared() { _spec.ClearField(matchplayer.FieldRankNew, field.TypeInt) } if value, ok := mpu.mutation.RankOld(); ok { _spec.SetField(matchplayer.FieldRankOld, field.TypeInt, value) } if value, ok := mpu.mutation.AddedRankOld(); ok { _spec.AddField(matchplayer.FieldRankOld, field.TypeInt, value) } if mpu.mutation.RankOldCleared() { _spec.ClearField(matchplayer.FieldRankOld, field.TypeInt) } if value, ok := mpu.mutation.Mk2(); ok { _spec.SetField(matchplayer.FieldMk2, field.TypeUint, value) } if value, ok := mpu.mutation.AddedMk2(); ok { _spec.AddField(matchplayer.FieldMk2, field.TypeUint, value) } if mpu.mutation.Mk2Cleared() { _spec.ClearField(matchplayer.FieldMk2, field.TypeUint) } if value, ok := mpu.mutation.Mk3(); ok { _spec.SetField(matchplayer.FieldMk3, field.TypeUint, value) } if value, ok := mpu.mutation.AddedMk3(); ok { _spec.AddField(matchplayer.FieldMk3, field.TypeUint, value) } if mpu.mutation.Mk3Cleared() { _spec.ClearField(matchplayer.FieldMk3, field.TypeUint) } if value, ok := mpu.mutation.Mk4(); ok { _spec.SetField(matchplayer.FieldMk4, field.TypeUint, value) } if value, ok := mpu.mutation.AddedMk4(); ok { _spec.AddField(matchplayer.FieldMk4, field.TypeUint, value) } if mpu.mutation.Mk4Cleared() { _spec.ClearField(matchplayer.FieldMk4, field.TypeUint) } if value, ok := mpu.mutation.Mk5(); ok { _spec.SetField(matchplayer.FieldMk5, field.TypeUint, value) } if value, ok := mpu.mutation.AddedMk5(); ok { _spec.AddField(matchplayer.FieldMk5, field.TypeUint, value) } if mpu.mutation.Mk5Cleared() { _spec.ClearField(matchplayer.FieldMk5, field.TypeUint) } if value, ok := mpu.mutation.DmgEnemy(); ok { _spec.SetField(matchplayer.FieldDmgEnemy, field.TypeUint, value) } if value, ok := mpu.mutation.AddedDmgEnemy(); ok { _spec.AddField(matchplayer.FieldDmgEnemy, field.TypeUint, value) } if mpu.mutation.DmgEnemyCleared() { _spec.ClearField(matchplayer.FieldDmgEnemy, field.TypeUint) } if value, ok := mpu.mutation.DmgTeam(); ok { _spec.SetField(matchplayer.FieldDmgTeam, field.TypeUint, value) } if value, ok := mpu.mutation.AddedDmgTeam(); ok { _spec.AddField(matchplayer.FieldDmgTeam, field.TypeUint, value) } if mpu.mutation.DmgTeamCleared() { _spec.ClearField(matchplayer.FieldDmgTeam, field.TypeUint) } if value, ok := mpu.mutation.UdHe(); ok { _spec.SetField(matchplayer.FieldUdHe, field.TypeUint, value) } if value, ok := mpu.mutation.AddedUdHe(); ok { _spec.AddField(matchplayer.FieldUdHe, field.TypeUint, value) } if mpu.mutation.UdHeCleared() { _spec.ClearField(matchplayer.FieldUdHe, field.TypeUint) } if value, ok := mpu.mutation.UdFlames(); ok { _spec.SetField(matchplayer.FieldUdFlames, field.TypeUint, value) } if value, ok := mpu.mutation.AddedUdFlames(); ok { _spec.AddField(matchplayer.FieldUdFlames, field.TypeUint, value) } if mpu.mutation.UdFlamesCleared() { _spec.ClearField(matchplayer.FieldUdFlames, field.TypeUint) } if value, ok := mpu.mutation.UdFlash(); ok { _spec.SetField(matchplayer.FieldUdFlash, field.TypeUint, value) } if value, ok := mpu.mutation.AddedUdFlash(); ok { _spec.AddField(matchplayer.FieldUdFlash, field.TypeUint, value) } if mpu.mutation.UdFlashCleared() { _spec.ClearField(matchplayer.FieldUdFlash, field.TypeUint) } if value, ok := mpu.mutation.UdDecoy(); ok { _spec.SetField(matchplayer.FieldUdDecoy, field.TypeUint, value) } if value, ok := mpu.mutation.AddedUdDecoy(); ok { _spec.AddField(matchplayer.FieldUdDecoy, field.TypeUint, value) } if mpu.mutation.UdDecoyCleared() { _spec.ClearField(matchplayer.FieldUdDecoy, field.TypeUint) } if value, ok := mpu.mutation.UdSmoke(); ok { _spec.SetField(matchplayer.FieldUdSmoke, field.TypeUint, value) } if value, ok := mpu.mutation.AddedUdSmoke(); ok { _spec.AddField(matchplayer.FieldUdSmoke, field.TypeUint, value) } if mpu.mutation.UdSmokeCleared() { _spec.ClearField(matchplayer.FieldUdSmoke, field.TypeUint) } if value, ok := mpu.mutation.Crosshair(); ok { _spec.SetField(matchplayer.FieldCrosshair, field.TypeString, value) } if mpu.mutation.CrosshairCleared() { _spec.ClearField(matchplayer.FieldCrosshair, field.TypeString) } if value, ok := mpu.mutation.Color(); ok { _spec.SetField(matchplayer.FieldColor, field.TypeEnum, value) } if mpu.mutation.ColorCleared() { _spec.ClearField(matchplayer.FieldColor, field.TypeEnum) } if value, ok := mpu.mutation.Kast(); ok { _spec.SetField(matchplayer.FieldKast, field.TypeInt, value) } if value, ok := mpu.mutation.AddedKast(); ok { _spec.AddField(matchplayer.FieldKast, field.TypeInt, value) } if mpu.mutation.KastCleared() { _spec.ClearField(matchplayer.FieldKast, field.TypeInt) } if value, ok := mpu.mutation.FlashDurationSelf(); ok { _spec.SetField(matchplayer.FieldFlashDurationSelf, field.TypeFloat32, value) } if value, ok := mpu.mutation.AddedFlashDurationSelf(); ok { _spec.AddField(matchplayer.FieldFlashDurationSelf, field.TypeFloat32, value) } if mpu.mutation.FlashDurationSelfCleared() { _spec.ClearField(matchplayer.FieldFlashDurationSelf, field.TypeFloat32) } if value, ok := mpu.mutation.FlashDurationTeam(); ok { _spec.SetField(matchplayer.FieldFlashDurationTeam, field.TypeFloat32, value) } if value, ok := mpu.mutation.AddedFlashDurationTeam(); ok { _spec.AddField(matchplayer.FieldFlashDurationTeam, field.TypeFloat32, value) } if mpu.mutation.FlashDurationTeamCleared() { _spec.ClearField(matchplayer.FieldFlashDurationTeam, field.TypeFloat32) } if value, ok := mpu.mutation.FlashDurationEnemy(); ok { _spec.SetField(matchplayer.FieldFlashDurationEnemy, field.TypeFloat32, value) } if value, ok := mpu.mutation.AddedFlashDurationEnemy(); ok { _spec.AddField(matchplayer.FieldFlashDurationEnemy, field.TypeFloat32, value) } if mpu.mutation.FlashDurationEnemyCleared() { _spec.ClearField(matchplayer.FieldFlashDurationEnemy, field.TypeFloat32) } if value, ok := mpu.mutation.FlashTotalSelf(); ok { _spec.SetField(matchplayer.FieldFlashTotalSelf, field.TypeUint, value) } if value, ok := mpu.mutation.AddedFlashTotalSelf(); ok { _spec.AddField(matchplayer.FieldFlashTotalSelf, field.TypeUint, value) } if mpu.mutation.FlashTotalSelfCleared() { _spec.ClearField(matchplayer.FieldFlashTotalSelf, field.TypeUint) } if value, ok := mpu.mutation.FlashTotalTeam(); ok { _spec.SetField(matchplayer.FieldFlashTotalTeam, field.TypeUint, value) } if value, ok := mpu.mutation.AddedFlashTotalTeam(); ok { _spec.AddField(matchplayer.FieldFlashTotalTeam, field.TypeUint, value) } if mpu.mutation.FlashTotalTeamCleared() { _spec.ClearField(matchplayer.FieldFlashTotalTeam, field.TypeUint) } if value, ok := mpu.mutation.FlashTotalEnemy(); ok { _spec.SetField(matchplayer.FieldFlashTotalEnemy, field.TypeUint, value) } if value, ok := mpu.mutation.AddedFlashTotalEnemy(); ok { _spec.AddField(matchplayer.FieldFlashTotalEnemy, field.TypeUint, value) } if mpu.mutation.FlashTotalEnemyCleared() { _spec.ClearField(matchplayer.FieldFlashTotalEnemy, field.TypeUint) } if value, ok := mpu.mutation.FlashAssists(); ok { _spec.SetField(matchplayer.FieldFlashAssists, field.TypeInt, value) } if value, ok := mpu.mutation.AddedFlashAssists(); ok { _spec.AddField(matchplayer.FieldFlashAssists, field.TypeInt, value) } if mpu.mutation.FlashAssistsCleared() { _spec.ClearField(matchplayer.FieldFlashAssists, field.TypeInt) } if value, ok := mpu.mutation.AvgPing(); ok { _spec.SetField(matchplayer.FieldAvgPing, field.TypeFloat64, value) } if value, ok := mpu.mutation.AddedAvgPing(); ok { _spec.AddField(matchplayer.FieldAvgPing, field.TypeFloat64, value) } if mpu.mutation.AvgPingCleared() { _spec.ClearField(matchplayer.FieldAvgPing, field.TypeFloat64) } if mpu.mutation.MatchesCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, Table: matchplayer.MatchesTable, Columns: []string{matchplayer.MatchesColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: &sqlgraph.FieldSpec{ Type: field.TypeUint64, Column: match.FieldID, }, }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := mpu.mutation.MatchesIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, Table: matchplayer.MatchesTable, Columns: []string{matchplayer.MatchesColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: &sqlgraph.FieldSpec{ Type: field.TypeUint64, Column: match.FieldID, }, }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } if mpu.mutation.PlayersCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, Table: matchplayer.PlayersTable, Columns: []string{matchplayer.PlayersColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: &sqlgraph.FieldSpec{ Type: field.TypeUint64, Column: player.FieldID, }, }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := mpu.mutation.PlayersIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, Table: matchplayer.PlayersTable, Columns: []string{matchplayer.PlayersColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: &sqlgraph.FieldSpec{ Type: field.TypeUint64, Column: player.FieldID, }, }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } if mpu.mutation.WeaponStatsCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: matchplayer.WeaponStatsTable, Columns: []string{matchplayer.WeaponStatsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: &sqlgraph.FieldSpec{ Type: field.TypeInt, Column: weapon.FieldID, }, }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := mpu.mutation.RemovedWeaponStatsIDs(); len(nodes) > 0 && !mpu.mutation.WeaponStatsCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: matchplayer.WeaponStatsTable, Columns: []string{matchplayer.WeaponStatsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: &sqlgraph.FieldSpec{ Type: field.TypeInt, Column: weapon.FieldID, }, }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := mpu.mutation.WeaponStatsIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: matchplayer.WeaponStatsTable, Columns: []string{matchplayer.WeaponStatsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: &sqlgraph.FieldSpec{ Type: field.TypeInt, Column: weapon.FieldID, }, }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } if mpu.mutation.RoundStatsCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: matchplayer.RoundStatsTable, Columns: []string{matchplayer.RoundStatsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: &sqlgraph.FieldSpec{ Type: field.TypeInt, Column: roundstats.FieldID, }, }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := mpu.mutation.RemovedRoundStatsIDs(); len(nodes) > 0 && !mpu.mutation.RoundStatsCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: matchplayer.RoundStatsTable, Columns: []string{matchplayer.RoundStatsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: &sqlgraph.FieldSpec{ Type: field.TypeInt, Column: roundstats.FieldID, }, }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := mpu.mutation.RoundStatsIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: matchplayer.RoundStatsTable, Columns: []string{matchplayer.RoundStatsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: &sqlgraph.FieldSpec{ Type: field.TypeInt, Column: roundstats.FieldID, }, }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } if mpu.mutation.SprayCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: matchplayer.SprayTable, Columns: []string{matchplayer.SprayColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: &sqlgraph.FieldSpec{ Type: field.TypeInt, Column: spray.FieldID, }, }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := mpu.mutation.RemovedSprayIDs(); len(nodes) > 0 && !mpu.mutation.SprayCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: matchplayer.SprayTable, Columns: []string{matchplayer.SprayColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: &sqlgraph.FieldSpec{ Type: field.TypeInt, Column: spray.FieldID, }, }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := mpu.mutation.SprayIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: matchplayer.SprayTable, Columns: []string{matchplayer.SprayColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: &sqlgraph.FieldSpec{ Type: field.TypeInt, Column: spray.FieldID, }, }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } if mpu.mutation.MessagesCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: matchplayer.MessagesTable, Columns: []string{matchplayer.MessagesColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: &sqlgraph.FieldSpec{ Type: field.TypeInt, Column: messages.FieldID, }, }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := mpu.mutation.RemovedMessagesIDs(); len(nodes) > 0 && !mpu.mutation.MessagesCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: matchplayer.MessagesTable, Columns: []string{matchplayer.MessagesColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: &sqlgraph.FieldSpec{ Type: field.TypeInt, Column: messages.FieldID, }, }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := mpu.mutation.MessagesIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: matchplayer.MessagesTable, Columns: []string{matchplayer.MessagesColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: &sqlgraph.FieldSpec{ Type: field.TypeInt, Column: messages.FieldID, }, }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } _spec.AddModifiers(mpu.modifiers...) if n, err = sqlgraph.UpdateNodes(ctx, mpu.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{matchplayer.Label} } else if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } return 0, err } mpu.mutation.done = true return n, nil } // MatchPlayerUpdateOne is the builder for updating a single MatchPlayer entity. type MatchPlayerUpdateOne struct { config fields []string hooks []Hook mutation *MatchPlayerMutation modifiers []func(*sql.UpdateBuilder) } // SetTeamID sets the "team_id" field. func (mpuo *MatchPlayerUpdateOne) SetTeamID(i int) *MatchPlayerUpdateOne { mpuo.mutation.ResetTeamID() mpuo.mutation.SetTeamID(i) return mpuo } // AddTeamID adds i to the "team_id" field. func (mpuo *MatchPlayerUpdateOne) AddTeamID(i int) *MatchPlayerUpdateOne { mpuo.mutation.AddTeamID(i) return mpuo } // SetKills sets the "kills" field. func (mpuo *MatchPlayerUpdateOne) SetKills(i int) *MatchPlayerUpdateOne { mpuo.mutation.ResetKills() mpuo.mutation.SetKills(i) return mpuo } // AddKills adds i to the "kills" field. func (mpuo *MatchPlayerUpdateOne) AddKills(i int) *MatchPlayerUpdateOne { mpuo.mutation.AddKills(i) return mpuo } // SetDeaths sets the "deaths" field. func (mpuo *MatchPlayerUpdateOne) SetDeaths(i int) *MatchPlayerUpdateOne { mpuo.mutation.ResetDeaths() mpuo.mutation.SetDeaths(i) return mpuo } // AddDeaths adds i to the "deaths" field. func (mpuo *MatchPlayerUpdateOne) AddDeaths(i int) *MatchPlayerUpdateOne { mpuo.mutation.AddDeaths(i) return mpuo } // SetAssists sets the "assists" field. func (mpuo *MatchPlayerUpdateOne) SetAssists(i int) *MatchPlayerUpdateOne { mpuo.mutation.ResetAssists() mpuo.mutation.SetAssists(i) return mpuo } // AddAssists adds i to the "assists" field. func (mpuo *MatchPlayerUpdateOne) AddAssists(i int) *MatchPlayerUpdateOne { mpuo.mutation.AddAssists(i) return mpuo } // SetHeadshot sets the "headshot" field. func (mpuo *MatchPlayerUpdateOne) SetHeadshot(i int) *MatchPlayerUpdateOne { mpuo.mutation.ResetHeadshot() mpuo.mutation.SetHeadshot(i) return mpuo } // AddHeadshot adds i to the "headshot" field. func (mpuo *MatchPlayerUpdateOne) AddHeadshot(i int) *MatchPlayerUpdateOne { mpuo.mutation.AddHeadshot(i) return mpuo } // SetMvp sets the "mvp" field. func (mpuo *MatchPlayerUpdateOne) SetMvp(u uint) *MatchPlayerUpdateOne { mpuo.mutation.ResetMvp() mpuo.mutation.SetMvp(u) return mpuo } // AddMvp adds u to the "mvp" field. func (mpuo *MatchPlayerUpdateOne) AddMvp(u int) *MatchPlayerUpdateOne { mpuo.mutation.AddMvp(u) return mpuo } // SetScore sets the "score" field. func (mpuo *MatchPlayerUpdateOne) SetScore(i int) *MatchPlayerUpdateOne { mpuo.mutation.ResetScore() mpuo.mutation.SetScore(i) return mpuo } // AddScore adds i to the "score" field. func (mpuo *MatchPlayerUpdateOne) AddScore(i int) *MatchPlayerUpdateOne { mpuo.mutation.AddScore(i) return mpuo } // SetRankNew sets the "rank_new" field. func (mpuo *MatchPlayerUpdateOne) SetRankNew(i int) *MatchPlayerUpdateOne { mpuo.mutation.ResetRankNew() mpuo.mutation.SetRankNew(i) return mpuo } // SetNillableRankNew sets the "rank_new" field if the given value is not nil. func (mpuo *MatchPlayerUpdateOne) SetNillableRankNew(i *int) *MatchPlayerUpdateOne { if i != nil { mpuo.SetRankNew(*i) } return mpuo } // AddRankNew adds i to the "rank_new" field. func (mpuo *MatchPlayerUpdateOne) AddRankNew(i int) *MatchPlayerUpdateOne { mpuo.mutation.AddRankNew(i) return mpuo } // ClearRankNew clears the value of the "rank_new" field. func (mpuo *MatchPlayerUpdateOne) ClearRankNew() *MatchPlayerUpdateOne { mpuo.mutation.ClearRankNew() return mpuo } // SetRankOld sets the "rank_old" field. func (mpuo *MatchPlayerUpdateOne) SetRankOld(i int) *MatchPlayerUpdateOne { mpuo.mutation.ResetRankOld() mpuo.mutation.SetRankOld(i) return mpuo } // SetNillableRankOld sets the "rank_old" field if the given value is not nil. func (mpuo *MatchPlayerUpdateOne) SetNillableRankOld(i *int) *MatchPlayerUpdateOne { if i != nil { mpuo.SetRankOld(*i) } return mpuo } // AddRankOld adds i to the "rank_old" field. func (mpuo *MatchPlayerUpdateOne) AddRankOld(i int) *MatchPlayerUpdateOne { mpuo.mutation.AddRankOld(i) return mpuo } // ClearRankOld clears the value of the "rank_old" field. func (mpuo *MatchPlayerUpdateOne) ClearRankOld() *MatchPlayerUpdateOne { mpuo.mutation.ClearRankOld() return mpuo } // SetMk2 sets the "mk_2" field. func (mpuo *MatchPlayerUpdateOne) SetMk2(u uint) *MatchPlayerUpdateOne { mpuo.mutation.ResetMk2() mpuo.mutation.SetMk2(u) return mpuo } // SetNillableMk2 sets the "mk_2" field if the given value is not nil. func (mpuo *MatchPlayerUpdateOne) SetNillableMk2(u *uint) *MatchPlayerUpdateOne { if u != nil { mpuo.SetMk2(*u) } return mpuo } // AddMk2 adds u to the "mk_2" field. func (mpuo *MatchPlayerUpdateOne) AddMk2(u int) *MatchPlayerUpdateOne { mpuo.mutation.AddMk2(u) return mpuo } // ClearMk2 clears the value of the "mk_2" field. func (mpuo *MatchPlayerUpdateOne) ClearMk2() *MatchPlayerUpdateOne { mpuo.mutation.ClearMk2() return mpuo } // SetMk3 sets the "mk_3" field. func (mpuo *MatchPlayerUpdateOne) SetMk3(u uint) *MatchPlayerUpdateOne { mpuo.mutation.ResetMk3() mpuo.mutation.SetMk3(u) return mpuo } // SetNillableMk3 sets the "mk_3" field if the given value is not nil. func (mpuo *MatchPlayerUpdateOne) SetNillableMk3(u *uint) *MatchPlayerUpdateOne { if u != nil { mpuo.SetMk3(*u) } return mpuo } // AddMk3 adds u to the "mk_3" field. func (mpuo *MatchPlayerUpdateOne) AddMk3(u int) *MatchPlayerUpdateOne { mpuo.mutation.AddMk3(u) return mpuo } // ClearMk3 clears the value of the "mk_3" field. func (mpuo *MatchPlayerUpdateOne) ClearMk3() *MatchPlayerUpdateOne { mpuo.mutation.ClearMk3() return mpuo } // SetMk4 sets the "mk_4" field. func (mpuo *MatchPlayerUpdateOne) SetMk4(u uint) *MatchPlayerUpdateOne { mpuo.mutation.ResetMk4() mpuo.mutation.SetMk4(u) return mpuo } // SetNillableMk4 sets the "mk_4" field if the given value is not nil. func (mpuo *MatchPlayerUpdateOne) SetNillableMk4(u *uint) *MatchPlayerUpdateOne { if u != nil { mpuo.SetMk4(*u) } return mpuo } // AddMk4 adds u to the "mk_4" field. func (mpuo *MatchPlayerUpdateOne) AddMk4(u int) *MatchPlayerUpdateOne { mpuo.mutation.AddMk4(u) return mpuo } // ClearMk4 clears the value of the "mk_4" field. func (mpuo *MatchPlayerUpdateOne) ClearMk4() *MatchPlayerUpdateOne { mpuo.mutation.ClearMk4() return mpuo } // SetMk5 sets the "mk_5" field. func (mpuo *MatchPlayerUpdateOne) SetMk5(u uint) *MatchPlayerUpdateOne { mpuo.mutation.ResetMk5() mpuo.mutation.SetMk5(u) return mpuo } // SetNillableMk5 sets the "mk_5" field if the given value is not nil. func (mpuo *MatchPlayerUpdateOne) SetNillableMk5(u *uint) *MatchPlayerUpdateOne { if u != nil { mpuo.SetMk5(*u) } return mpuo } // AddMk5 adds u to the "mk_5" field. func (mpuo *MatchPlayerUpdateOne) AddMk5(u int) *MatchPlayerUpdateOne { mpuo.mutation.AddMk5(u) return mpuo } // ClearMk5 clears the value of the "mk_5" field. func (mpuo *MatchPlayerUpdateOne) ClearMk5() *MatchPlayerUpdateOne { mpuo.mutation.ClearMk5() return mpuo } // SetDmgEnemy sets the "dmg_enemy" field. func (mpuo *MatchPlayerUpdateOne) SetDmgEnemy(u uint) *MatchPlayerUpdateOne { mpuo.mutation.ResetDmgEnemy() mpuo.mutation.SetDmgEnemy(u) return mpuo } // SetNillableDmgEnemy sets the "dmg_enemy" field if the given value is not nil. func (mpuo *MatchPlayerUpdateOne) SetNillableDmgEnemy(u *uint) *MatchPlayerUpdateOne { if u != nil { mpuo.SetDmgEnemy(*u) } return mpuo } // AddDmgEnemy adds u to the "dmg_enemy" field. func (mpuo *MatchPlayerUpdateOne) AddDmgEnemy(u int) *MatchPlayerUpdateOne { mpuo.mutation.AddDmgEnemy(u) return mpuo } // ClearDmgEnemy clears the value of the "dmg_enemy" field. func (mpuo *MatchPlayerUpdateOne) ClearDmgEnemy() *MatchPlayerUpdateOne { mpuo.mutation.ClearDmgEnemy() return mpuo } // SetDmgTeam sets the "dmg_team" field. func (mpuo *MatchPlayerUpdateOne) SetDmgTeam(u uint) *MatchPlayerUpdateOne { mpuo.mutation.ResetDmgTeam() mpuo.mutation.SetDmgTeam(u) return mpuo } // SetNillableDmgTeam sets the "dmg_team" field if the given value is not nil. func (mpuo *MatchPlayerUpdateOne) SetNillableDmgTeam(u *uint) *MatchPlayerUpdateOne { if u != nil { mpuo.SetDmgTeam(*u) } return mpuo } // AddDmgTeam adds u to the "dmg_team" field. func (mpuo *MatchPlayerUpdateOne) AddDmgTeam(u int) *MatchPlayerUpdateOne { mpuo.mutation.AddDmgTeam(u) return mpuo } // ClearDmgTeam clears the value of the "dmg_team" field. func (mpuo *MatchPlayerUpdateOne) ClearDmgTeam() *MatchPlayerUpdateOne { mpuo.mutation.ClearDmgTeam() return mpuo } // SetUdHe sets the "ud_he" field. func (mpuo *MatchPlayerUpdateOne) SetUdHe(u uint) *MatchPlayerUpdateOne { mpuo.mutation.ResetUdHe() mpuo.mutation.SetUdHe(u) return mpuo } // SetNillableUdHe sets the "ud_he" field if the given value is not nil. func (mpuo *MatchPlayerUpdateOne) SetNillableUdHe(u *uint) *MatchPlayerUpdateOne { if u != nil { mpuo.SetUdHe(*u) } return mpuo } // AddUdHe adds u to the "ud_he" field. func (mpuo *MatchPlayerUpdateOne) AddUdHe(u int) *MatchPlayerUpdateOne { mpuo.mutation.AddUdHe(u) return mpuo } // ClearUdHe clears the value of the "ud_he" field. func (mpuo *MatchPlayerUpdateOne) ClearUdHe() *MatchPlayerUpdateOne { mpuo.mutation.ClearUdHe() return mpuo } // SetUdFlames sets the "ud_flames" field. func (mpuo *MatchPlayerUpdateOne) SetUdFlames(u uint) *MatchPlayerUpdateOne { mpuo.mutation.ResetUdFlames() mpuo.mutation.SetUdFlames(u) return mpuo } // SetNillableUdFlames sets the "ud_flames" field if the given value is not nil. func (mpuo *MatchPlayerUpdateOne) SetNillableUdFlames(u *uint) *MatchPlayerUpdateOne { if u != nil { mpuo.SetUdFlames(*u) } return mpuo } // AddUdFlames adds u to the "ud_flames" field. func (mpuo *MatchPlayerUpdateOne) AddUdFlames(u int) *MatchPlayerUpdateOne { mpuo.mutation.AddUdFlames(u) return mpuo } // ClearUdFlames clears the value of the "ud_flames" field. func (mpuo *MatchPlayerUpdateOne) ClearUdFlames() *MatchPlayerUpdateOne { mpuo.mutation.ClearUdFlames() return mpuo } // SetUdFlash sets the "ud_flash" field. func (mpuo *MatchPlayerUpdateOne) SetUdFlash(u uint) *MatchPlayerUpdateOne { mpuo.mutation.ResetUdFlash() mpuo.mutation.SetUdFlash(u) return mpuo } // SetNillableUdFlash sets the "ud_flash" field if the given value is not nil. func (mpuo *MatchPlayerUpdateOne) SetNillableUdFlash(u *uint) *MatchPlayerUpdateOne { if u != nil { mpuo.SetUdFlash(*u) } return mpuo } // AddUdFlash adds u to the "ud_flash" field. func (mpuo *MatchPlayerUpdateOne) AddUdFlash(u int) *MatchPlayerUpdateOne { mpuo.mutation.AddUdFlash(u) return mpuo } // ClearUdFlash clears the value of the "ud_flash" field. func (mpuo *MatchPlayerUpdateOne) ClearUdFlash() *MatchPlayerUpdateOne { mpuo.mutation.ClearUdFlash() return mpuo } // SetUdDecoy sets the "ud_decoy" field. func (mpuo *MatchPlayerUpdateOne) SetUdDecoy(u uint) *MatchPlayerUpdateOne { mpuo.mutation.ResetUdDecoy() mpuo.mutation.SetUdDecoy(u) return mpuo } // SetNillableUdDecoy sets the "ud_decoy" field if the given value is not nil. func (mpuo *MatchPlayerUpdateOne) SetNillableUdDecoy(u *uint) *MatchPlayerUpdateOne { if u != nil { mpuo.SetUdDecoy(*u) } return mpuo } // AddUdDecoy adds u to the "ud_decoy" field. func (mpuo *MatchPlayerUpdateOne) AddUdDecoy(u int) *MatchPlayerUpdateOne { mpuo.mutation.AddUdDecoy(u) return mpuo } // ClearUdDecoy clears the value of the "ud_decoy" field. func (mpuo *MatchPlayerUpdateOne) ClearUdDecoy() *MatchPlayerUpdateOne { mpuo.mutation.ClearUdDecoy() return mpuo } // SetUdSmoke sets the "ud_smoke" field. func (mpuo *MatchPlayerUpdateOne) SetUdSmoke(u uint) *MatchPlayerUpdateOne { mpuo.mutation.ResetUdSmoke() mpuo.mutation.SetUdSmoke(u) return mpuo } // SetNillableUdSmoke sets the "ud_smoke" field if the given value is not nil. func (mpuo *MatchPlayerUpdateOne) SetNillableUdSmoke(u *uint) *MatchPlayerUpdateOne { if u != nil { mpuo.SetUdSmoke(*u) } return mpuo } // AddUdSmoke adds u to the "ud_smoke" field. func (mpuo *MatchPlayerUpdateOne) AddUdSmoke(u int) *MatchPlayerUpdateOne { mpuo.mutation.AddUdSmoke(u) return mpuo } // ClearUdSmoke clears the value of the "ud_smoke" field. func (mpuo *MatchPlayerUpdateOne) ClearUdSmoke() *MatchPlayerUpdateOne { mpuo.mutation.ClearUdSmoke() return mpuo } // SetCrosshair sets the "crosshair" field. func (mpuo *MatchPlayerUpdateOne) SetCrosshair(s string) *MatchPlayerUpdateOne { mpuo.mutation.SetCrosshair(s) return mpuo } // SetNillableCrosshair sets the "crosshair" field if the given value is not nil. func (mpuo *MatchPlayerUpdateOne) SetNillableCrosshair(s *string) *MatchPlayerUpdateOne { if s != nil { mpuo.SetCrosshair(*s) } return mpuo } // ClearCrosshair clears the value of the "crosshair" field. func (mpuo *MatchPlayerUpdateOne) ClearCrosshair() *MatchPlayerUpdateOne { mpuo.mutation.ClearCrosshair() return mpuo } // SetColor sets the "color" field. func (mpuo *MatchPlayerUpdateOne) SetColor(m matchplayer.Color) *MatchPlayerUpdateOne { mpuo.mutation.SetColor(m) return mpuo } // SetNillableColor sets the "color" field if the given value is not nil. func (mpuo *MatchPlayerUpdateOne) SetNillableColor(m *matchplayer.Color) *MatchPlayerUpdateOne { if m != nil { mpuo.SetColor(*m) } return mpuo } // ClearColor clears the value of the "color" field. func (mpuo *MatchPlayerUpdateOne) ClearColor() *MatchPlayerUpdateOne { mpuo.mutation.ClearColor() return mpuo } // SetKast sets the "kast" field. func (mpuo *MatchPlayerUpdateOne) SetKast(i int) *MatchPlayerUpdateOne { mpuo.mutation.ResetKast() mpuo.mutation.SetKast(i) return mpuo } // SetNillableKast sets the "kast" field if the given value is not nil. func (mpuo *MatchPlayerUpdateOne) SetNillableKast(i *int) *MatchPlayerUpdateOne { if i != nil { mpuo.SetKast(*i) } return mpuo } // AddKast adds i to the "kast" field. func (mpuo *MatchPlayerUpdateOne) AddKast(i int) *MatchPlayerUpdateOne { mpuo.mutation.AddKast(i) return mpuo } // ClearKast clears the value of the "kast" field. func (mpuo *MatchPlayerUpdateOne) ClearKast() *MatchPlayerUpdateOne { mpuo.mutation.ClearKast() return mpuo } // SetFlashDurationSelf sets the "flash_duration_self" field. func (mpuo *MatchPlayerUpdateOne) SetFlashDurationSelf(f float32) *MatchPlayerUpdateOne { mpuo.mutation.ResetFlashDurationSelf() mpuo.mutation.SetFlashDurationSelf(f) return mpuo } // SetNillableFlashDurationSelf sets the "flash_duration_self" field if the given value is not nil. func (mpuo *MatchPlayerUpdateOne) SetNillableFlashDurationSelf(f *float32) *MatchPlayerUpdateOne { if f != nil { mpuo.SetFlashDurationSelf(*f) } return mpuo } // AddFlashDurationSelf adds f to the "flash_duration_self" field. func (mpuo *MatchPlayerUpdateOne) AddFlashDurationSelf(f float32) *MatchPlayerUpdateOne { mpuo.mutation.AddFlashDurationSelf(f) return mpuo } // ClearFlashDurationSelf clears the value of the "flash_duration_self" field. func (mpuo *MatchPlayerUpdateOne) ClearFlashDurationSelf() *MatchPlayerUpdateOne { mpuo.mutation.ClearFlashDurationSelf() return mpuo } // SetFlashDurationTeam sets the "flash_duration_team" field. func (mpuo *MatchPlayerUpdateOne) SetFlashDurationTeam(f float32) *MatchPlayerUpdateOne { mpuo.mutation.ResetFlashDurationTeam() mpuo.mutation.SetFlashDurationTeam(f) return mpuo } // SetNillableFlashDurationTeam sets the "flash_duration_team" field if the given value is not nil. func (mpuo *MatchPlayerUpdateOne) SetNillableFlashDurationTeam(f *float32) *MatchPlayerUpdateOne { if f != nil { mpuo.SetFlashDurationTeam(*f) } return mpuo } // AddFlashDurationTeam adds f to the "flash_duration_team" field. func (mpuo *MatchPlayerUpdateOne) AddFlashDurationTeam(f float32) *MatchPlayerUpdateOne { mpuo.mutation.AddFlashDurationTeam(f) return mpuo } // ClearFlashDurationTeam clears the value of the "flash_duration_team" field. func (mpuo *MatchPlayerUpdateOne) ClearFlashDurationTeam() *MatchPlayerUpdateOne { mpuo.mutation.ClearFlashDurationTeam() return mpuo } // SetFlashDurationEnemy sets the "flash_duration_enemy" field. func (mpuo *MatchPlayerUpdateOne) SetFlashDurationEnemy(f float32) *MatchPlayerUpdateOne { mpuo.mutation.ResetFlashDurationEnemy() mpuo.mutation.SetFlashDurationEnemy(f) return mpuo } // SetNillableFlashDurationEnemy sets the "flash_duration_enemy" field if the given value is not nil. func (mpuo *MatchPlayerUpdateOne) SetNillableFlashDurationEnemy(f *float32) *MatchPlayerUpdateOne { if f != nil { mpuo.SetFlashDurationEnemy(*f) } return mpuo } // AddFlashDurationEnemy adds f to the "flash_duration_enemy" field. func (mpuo *MatchPlayerUpdateOne) AddFlashDurationEnemy(f float32) *MatchPlayerUpdateOne { mpuo.mutation.AddFlashDurationEnemy(f) return mpuo } // ClearFlashDurationEnemy clears the value of the "flash_duration_enemy" field. func (mpuo *MatchPlayerUpdateOne) ClearFlashDurationEnemy() *MatchPlayerUpdateOne { mpuo.mutation.ClearFlashDurationEnemy() return mpuo } // SetFlashTotalSelf sets the "flash_total_self" field. func (mpuo *MatchPlayerUpdateOne) SetFlashTotalSelf(u uint) *MatchPlayerUpdateOne { mpuo.mutation.ResetFlashTotalSelf() mpuo.mutation.SetFlashTotalSelf(u) return mpuo } // SetNillableFlashTotalSelf sets the "flash_total_self" field if the given value is not nil. func (mpuo *MatchPlayerUpdateOne) SetNillableFlashTotalSelf(u *uint) *MatchPlayerUpdateOne { if u != nil { mpuo.SetFlashTotalSelf(*u) } return mpuo } // AddFlashTotalSelf adds u to the "flash_total_self" field. func (mpuo *MatchPlayerUpdateOne) AddFlashTotalSelf(u int) *MatchPlayerUpdateOne { mpuo.mutation.AddFlashTotalSelf(u) return mpuo } // ClearFlashTotalSelf clears the value of the "flash_total_self" field. func (mpuo *MatchPlayerUpdateOne) ClearFlashTotalSelf() *MatchPlayerUpdateOne { mpuo.mutation.ClearFlashTotalSelf() return mpuo } // SetFlashTotalTeam sets the "flash_total_team" field. func (mpuo *MatchPlayerUpdateOne) SetFlashTotalTeam(u uint) *MatchPlayerUpdateOne { mpuo.mutation.ResetFlashTotalTeam() mpuo.mutation.SetFlashTotalTeam(u) return mpuo } // SetNillableFlashTotalTeam sets the "flash_total_team" field if the given value is not nil. func (mpuo *MatchPlayerUpdateOne) SetNillableFlashTotalTeam(u *uint) *MatchPlayerUpdateOne { if u != nil { mpuo.SetFlashTotalTeam(*u) } return mpuo } // AddFlashTotalTeam adds u to the "flash_total_team" field. func (mpuo *MatchPlayerUpdateOne) AddFlashTotalTeam(u int) *MatchPlayerUpdateOne { mpuo.mutation.AddFlashTotalTeam(u) return mpuo } // ClearFlashTotalTeam clears the value of the "flash_total_team" field. func (mpuo *MatchPlayerUpdateOne) ClearFlashTotalTeam() *MatchPlayerUpdateOne { mpuo.mutation.ClearFlashTotalTeam() return mpuo } // SetFlashTotalEnemy sets the "flash_total_enemy" field. func (mpuo *MatchPlayerUpdateOne) SetFlashTotalEnemy(u uint) *MatchPlayerUpdateOne { mpuo.mutation.ResetFlashTotalEnemy() mpuo.mutation.SetFlashTotalEnemy(u) return mpuo } // SetNillableFlashTotalEnemy sets the "flash_total_enemy" field if the given value is not nil. func (mpuo *MatchPlayerUpdateOne) SetNillableFlashTotalEnemy(u *uint) *MatchPlayerUpdateOne { if u != nil { mpuo.SetFlashTotalEnemy(*u) } return mpuo } // AddFlashTotalEnemy adds u to the "flash_total_enemy" field. func (mpuo *MatchPlayerUpdateOne) AddFlashTotalEnemy(u int) *MatchPlayerUpdateOne { mpuo.mutation.AddFlashTotalEnemy(u) return mpuo } // ClearFlashTotalEnemy clears the value of the "flash_total_enemy" field. func (mpuo *MatchPlayerUpdateOne) ClearFlashTotalEnemy() *MatchPlayerUpdateOne { mpuo.mutation.ClearFlashTotalEnemy() return mpuo } // SetMatchStats sets the "match_stats" field. func (mpuo *MatchPlayerUpdateOne) SetMatchStats(u uint64) *MatchPlayerUpdateOne { mpuo.mutation.SetMatchStats(u) return mpuo } // SetNillableMatchStats sets the "match_stats" field if the given value is not nil. func (mpuo *MatchPlayerUpdateOne) SetNillableMatchStats(u *uint64) *MatchPlayerUpdateOne { if u != nil { mpuo.SetMatchStats(*u) } return mpuo } // ClearMatchStats clears the value of the "match_stats" field. func (mpuo *MatchPlayerUpdateOne) ClearMatchStats() *MatchPlayerUpdateOne { mpuo.mutation.ClearMatchStats() return mpuo } // SetPlayerStats sets the "player_stats" field. func (mpuo *MatchPlayerUpdateOne) SetPlayerStats(u uint64) *MatchPlayerUpdateOne { mpuo.mutation.SetPlayerStats(u) return mpuo } // SetNillablePlayerStats sets the "player_stats" field if the given value is not nil. func (mpuo *MatchPlayerUpdateOne) SetNillablePlayerStats(u *uint64) *MatchPlayerUpdateOne { if u != nil { mpuo.SetPlayerStats(*u) } return mpuo } // ClearPlayerStats clears the value of the "player_stats" field. func (mpuo *MatchPlayerUpdateOne) ClearPlayerStats() *MatchPlayerUpdateOne { mpuo.mutation.ClearPlayerStats() return mpuo } // SetFlashAssists sets the "flash_assists" field. func (mpuo *MatchPlayerUpdateOne) SetFlashAssists(i int) *MatchPlayerUpdateOne { mpuo.mutation.ResetFlashAssists() mpuo.mutation.SetFlashAssists(i) return mpuo } // SetNillableFlashAssists sets the "flash_assists" field if the given value is not nil. func (mpuo *MatchPlayerUpdateOne) SetNillableFlashAssists(i *int) *MatchPlayerUpdateOne { if i != nil { mpuo.SetFlashAssists(*i) } return mpuo } // AddFlashAssists adds i to the "flash_assists" field. func (mpuo *MatchPlayerUpdateOne) AddFlashAssists(i int) *MatchPlayerUpdateOne { mpuo.mutation.AddFlashAssists(i) return mpuo } // ClearFlashAssists clears the value of the "flash_assists" field. func (mpuo *MatchPlayerUpdateOne) ClearFlashAssists() *MatchPlayerUpdateOne { mpuo.mutation.ClearFlashAssists() return mpuo } // SetAvgPing sets the "avg_ping" field. func (mpuo *MatchPlayerUpdateOne) SetAvgPing(f float64) *MatchPlayerUpdateOne { mpuo.mutation.ResetAvgPing() mpuo.mutation.SetAvgPing(f) return mpuo } // SetNillableAvgPing sets the "avg_ping" field if the given value is not nil. func (mpuo *MatchPlayerUpdateOne) SetNillableAvgPing(f *float64) *MatchPlayerUpdateOne { if f != nil { mpuo.SetAvgPing(*f) } return mpuo } // AddAvgPing adds f to the "avg_ping" field. func (mpuo *MatchPlayerUpdateOne) AddAvgPing(f float64) *MatchPlayerUpdateOne { mpuo.mutation.AddAvgPing(f) return mpuo } // ClearAvgPing clears the value of the "avg_ping" field. func (mpuo *MatchPlayerUpdateOne) ClearAvgPing() *MatchPlayerUpdateOne { mpuo.mutation.ClearAvgPing() return mpuo } // SetMatchesID sets the "matches" edge to the Match entity by ID. func (mpuo *MatchPlayerUpdateOne) SetMatchesID(id uint64) *MatchPlayerUpdateOne { mpuo.mutation.SetMatchesID(id) return mpuo } // SetNillableMatchesID sets the "matches" edge to the Match entity by ID if the given value is not nil. func (mpuo *MatchPlayerUpdateOne) SetNillableMatchesID(id *uint64) *MatchPlayerUpdateOne { if id != nil { mpuo = mpuo.SetMatchesID(*id) } return mpuo } // SetMatches sets the "matches" edge to the Match entity. func (mpuo *MatchPlayerUpdateOne) SetMatches(m *Match) *MatchPlayerUpdateOne { return mpuo.SetMatchesID(m.ID) } // SetPlayersID sets the "players" edge to the Player entity by ID. func (mpuo *MatchPlayerUpdateOne) SetPlayersID(id uint64) *MatchPlayerUpdateOne { mpuo.mutation.SetPlayersID(id) return mpuo } // SetNillablePlayersID sets the "players" edge to the Player entity by ID if the given value is not nil. func (mpuo *MatchPlayerUpdateOne) SetNillablePlayersID(id *uint64) *MatchPlayerUpdateOne { if id != nil { mpuo = mpuo.SetPlayersID(*id) } return mpuo } // SetPlayers sets the "players" edge to the Player entity. func (mpuo *MatchPlayerUpdateOne) SetPlayers(p *Player) *MatchPlayerUpdateOne { return mpuo.SetPlayersID(p.ID) } // AddWeaponStatIDs adds the "weapon_stats" edge to the Weapon entity by IDs. func (mpuo *MatchPlayerUpdateOne) AddWeaponStatIDs(ids ...int) *MatchPlayerUpdateOne { mpuo.mutation.AddWeaponStatIDs(ids...) return mpuo } // AddWeaponStats adds the "weapon_stats" edges to the Weapon entity. func (mpuo *MatchPlayerUpdateOne) AddWeaponStats(w ...*Weapon) *MatchPlayerUpdateOne { ids := make([]int, len(w)) for i := range w { ids[i] = w[i].ID } return mpuo.AddWeaponStatIDs(ids...) } // AddRoundStatIDs adds the "round_stats" edge to the RoundStats entity by IDs. func (mpuo *MatchPlayerUpdateOne) AddRoundStatIDs(ids ...int) *MatchPlayerUpdateOne { mpuo.mutation.AddRoundStatIDs(ids...) return mpuo } // AddRoundStats adds the "round_stats" edges to the RoundStats entity. func (mpuo *MatchPlayerUpdateOne) AddRoundStats(r ...*RoundStats) *MatchPlayerUpdateOne { ids := make([]int, len(r)) for i := range r { ids[i] = r[i].ID } return mpuo.AddRoundStatIDs(ids...) } // AddSprayIDs adds the "spray" edge to the Spray entity by IDs. func (mpuo *MatchPlayerUpdateOne) AddSprayIDs(ids ...int) *MatchPlayerUpdateOne { mpuo.mutation.AddSprayIDs(ids...) return mpuo } // AddSpray adds the "spray" edges to the Spray entity. func (mpuo *MatchPlayerUpdateOne) AddSpray(s ...*Spray) *MatchPlayerUpdateOne { ids := make([]int, len(s)) for i := range s { ids[i] = s[i].ID } return mpuo.AddSprayIDs(ids...) } // AddMessageIDs adds the "messages" edge to the Messages entity by IDs. func (mpuo *MatchPlayerUpdateOne) AddMessageIDs(ids ...int) *MatchPlayerUpdateOne { mpuo.mutation.AddMessageIDs(ids...) return mpuo } // AddMessages adds the "messages" edges to the Messages entity. func (mpuo *MatchPlayerUpdateOne) AddMessages(m ...*Messages) *MatchPlayerUpdateOne { ids := make([]int, len(m)) for i := range m { ids[i] = m[i].ID } return mpuo.AddMessageIDs(ids...) } // Mutation returns the MatchPlayerMutation object of the builder. func (mpuo *MatchPlayerUpdateOne) Mutation() *MatchPlayerMutation { return mpuo.mutation } // ClearMatches clears the "matches" edge to the Match entity. func (mpuo *MatchPlayerUpdateOne) ClearMatches() *MatchPlayerUpdateOne { mpuo.mutation.ClearMatches() return mpuo } // ClearPlayers clears the "players" edge to the Player entity. func (mpuo *MatchPlayerUpdateOne) ClearPlayers() *MatchPlayerUpdateOne { mpuo.mutation.ClearPlayers() return mpuo } // ClearWeaponStats clears all "weapon_stats" edges to the Weapon entity. func (mpuo *MatchPlayerUpdateOne) ClearWeaponStats() *MatchPlayerUpdateOne { mpuo.mutation.ClearWeaponStats() return mpuo } // RemoveWeaponStatIDs removes the "weapon_stats" edge to Weapon entities by IDs. func (mpuo *MatchPlayerUpdateOne) RemoveWeaponStatIDs(ids ...int) *MatchPlayerUpdateOne { mpuo.mutation.RemoveWeaponStatIDs(ids...) return mpuo } // RemoveWeaponStats removes "weapon_stats" edges to Weapon entities. func (mpuo *MatchPlayerUpdateOne) RemoveWeaponStats(w ...*Weapon) *MatchPlayerUpdateOne { ids := make([]int, len(w)) for i := range w { ids[i] = w[i].ID } return mpuo.RemoveWeaponStatIDs(ids...) } // ClearRoundStats clears all "round_stats" edges to the RoundStats entity. func (mpuo *MatchPlayerUpdateOne) ClearRoundStats() *MatchPlayerUpdateOne { mpuo.mutation.ClearRoundStats() return mpuo } // RemoveRoundStatIDs removes the "round_stats" edge to RoundStats entities by IDs. func (mpuo *MatchPlayerUpdateOne) RemoveRoundStatIDs(ids ...int) *MatchPlayerUpdateOne { mpuo.mutation.RemoveRoundStatIDs(ids...) return mpuo } // RemoveRoundStats removes "round_stats" edges to RoundStats entities. func (mpuo *MatchPlayerUpdateOne) RemoveRoundStats(r ...*RoundStats) *MatchPlayerUpdateOne { ids := make([]int, len(r)) for i := range r { ids[i] = r[i].ID } return mpuo.RemoveRoundStatIDs(ids...) } // ClearSpray clears all "spray" edges to the Spray entity. func (mpuo *MatchPlayerUpdateOne) ClearSpray() *MatchPlayerUpdateOne { mpuo.mutation.ClearSpray() return mpuo } // RemoveSprayIDs removes the "spray" edge to Spray entities by IDs. func (mpuo *MatchPlayerUpdateOne) RemoveSprayIDs(ids ...int) *MatchPlayerUpdateOne { mpuo.mutation.RemoveSprayIDs(ids...) return mpuo } // RemoveSpray removes "spray" edges to Spray entities. func (mpuo *MatchPlayerUpdateOne) RemoveSpray(s ...*Spray) *MatchPlayerUpdateOne { ids := make([]int, len(s)) for i := range s { ids[i] = s[i].ID } return mpuo.RemoveSprayIDs(ids...) } // ClearMessages clears all "messages" edges to the Messages entity. func (mpuo *MatchPlayerUpdateOne) ClearMessages() *MatchPlayerUpdateOne { mpuo.mutation.ClearMessages() return mpuo } // RemoveMessageIDs removes the "messages" edge to Messages entities by IDs. func (mpuo *MatchPlayerUpdateOne) RemoveMessageIDs(ids ...int) *MatchPlayerUpdateOne { mpuo.mutation.RemoveMessageIDs(ids...) return mpuo } // RemoveMessages removes "messages" edges to Messages entities. func (mpuo *MatchPlayerUpdateOne) RemoveMessages(m ...*Messages) *MatchPlayerUpdateOne { ids := make([]int, len(m)) for i := range m { ids[i] = m[i].ID } return mpuo.RemoveMessageIDs(ids...) } // Where appends a list predicates to the MatchPlayerUpdate builder. func (mpuo *MatchPlayerUpdateOne) Where(ps ...predicate.MatchPlayer) *MatchPlayerUpdateOne { mpuo.mutation.Where(ps...) return mpuo } // Select allows selecting one or more fields (columns) of the returned entity. // The default is selecting all fields defined in the entity schema. func (mpuo *MatchPlayerUpdateOne) Select(field string, fields ...string) *MatchPlayerUpdateOne { mpuo.fields = append([]string{field}, fields...) return mpuo } // Save executes the query and returns the updated MatchPlayer entity. func (mpuo *MatchPlayerUpdateOne) Save(ctx context.Context) (*MatchPlayer, error) { return withHooks[*MatchPlayer, MatchPlayerMutation](ctx, mpuo.sqlSave, mpuo.mutation, mpuo.hooks) } // SaveX is like Save, but panics if an error occurs. func (mpuo *MatchPlayerUpdateOne) SaveX(ctx context.Context) *MatchPlayer { node, err := mpuo.Save(ctx) if err != nil { panic(err) } return node } // Exec executes the query on the entity. func (mpuo *MatchPlayerUpdateOne) Exec(ctx context.Context) error { _, err := mpuo.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. func (mpuo *MatchPlayerUpdateOne) ExecX(ctx context.Context) { if err := mpuo.Exec(ctx); err != nil { panic(err) } } // check runs all checks and user-defined validators on the builder. func (mpuo *MatchPlayerUpdateOne) check() error { if v, ok := mpuo.mutation.Color(); ok { if err := matchplayer.ColorValidator(v); err != nil { return &ValidationError{Name: "color", err: fmt.Errorf(`ent: validator failed for field "MatchPlayer.color": %w`, err)} } } return nil } // Modify adds a statement modifier for attaching custom logic to the UPDATE statement. func (mpuo *MatchPlayerUpdateOne) Modify(modifiers ...func(u *sql.UpdateBuilder)) *MatchPlayerUpdateOne { mpuo.modifiers = append(mpuo.modifiers, modifiers...) return mpuo } func (mpuo *MatchPlayerUpdateOne) sqlSave(ctx context.Context) (_node *MatchPlayer, err error) { if err := mpuo.check(); err != nil { return _node, err } _spec := sqlgraph.NewUpdateSpec(matchplayer.Table, matchplayer.Columns, sqlgraph.NewFieldSpec(matchplayer.FieldID, field.TypeInt)) id, ok := mpuo.mutation.ID() if !ok { return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "MatchPlayer.id" for update`)} } _spec.Node.ID.Value = id if fields := mpuo.fields; len(fields) > 0 { _spec.Node.Columns = make([]string, 0, len(fields)) _spec.Node.Columns = append(_spec.Node.Columns, matchplayer.FieldID) for _, f := range fields { if !matchplayer.ValidColumn(f) { return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} } if f != matchplayer.FieldID { _spec.Node.Columns = append(_spec.Node.Columns, f) } } } if ps := mpuo.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } if value, ok := mpuo.mutation.TeamID(); ok { _spec.SetField(matchplayer.FieldTeamID, field.TypeInt, value) } if value, ok := mpuo.mutation.AddedTeamID(); ok { _spec.AddField(matchplayer.FieldTeamID, field.TypeInt, value) } if value, ok := mpuo.mutation.Kills(); ok { _spec.SetField(matchplayer.FieldKills, field.TypeInt, value) } if value, ok := mpuo.mutation.AddedKills(); ok { _spec.AddField(matchplayer.FieldKills, field.TypeInt, value) } if value, ok := mpuo.mutation.Deaths(); ok { _spec.SetField(matchplayer.FieldDeaths, field.TypeInt, value) } if value, ok := mpuo.mutation.AddedDeaths(); ok { _spec.AddField(matchplayer.FieldDeaths, field.TypeInt, value) } if value, ok := mpuo.mutation.Assists(); ok { _spec.SetField(matchplayer.FieldAssists, field.TypeInt, value) } if value, ok := mpuo.mutation.AddedAssists(); ok { _spec.AddField(matchplayer.FieldAssists, field.TypeInt, value) } if value, ok := mpuo.mutation.Headshot(); ok { _spec.SetField(matchplayer.FieldHeadshot, field.TypeInt, value) } if value, ok := mpuo.mutation.AddedHeadshot(); ok { _spec.AddField(matchplayer.FieldHeadshot, field.TypeInt, value) } if value, ok := mpuo.mutation.Mvp(); ok { _spec.SetField(matchplayer.FieldMvp, field.TypeUint, value) } if value, ok := mpuo.mutation.AddedMvp(); ok { _spec.AddField(matchplayer.FieldMvp, field.TypeUint, value) } if value, ok := mpuo.mutation.Score(); ok { _spec.SetField(matchplayer.FieldScore, field.TypeInt, value) } if value, ok := mpuo.mutation.AddedScore(); ok { _spec.AddField(matchplayer.FieldScore, field.TypeInt, value) } if value, ok := mpuo.mutation.RankNew(); ok { _spec.SetField(matchplayer.FieldRankNew, field.TypeInt, value) } if value, ok := mpuo.mutation.AddedRankNew(); ok { _spec.AddField(matchplayer.FieldRankNew, field.TypeInt, value) } if mpuo.mutation.RankNewCleared() { _spec.ClearField(matchplayer.FieldRankNew, field.TypeInt) } if value, ok := mpuo.mutation.RankOld(); ok { _spec.SetField(matchplayer.FieldRankOld, field.TypeInt, value) } if value, ok := mpuo.mutation.AddedRankOld(); ok { _spec.AddField(matchplayer.FieldRankOld, field.TypeInt, value) } if mpuo.mutation.RankOldCleared() { _spec.ClearField(matchplayer.FieldRankOld, field.TypeInt) } if value, ok := mpuo.mutation.Mk2(); ok { _spec.SetField(matchplayer.FieldMk2, field.TypeUint, value) } if value, ok := mpuo.mutation.AddedMk2(); ok { _spec.AddField(matchplayer.FieldMk2, field.TypeUint, value) } if mpuo.mutation.Mk2Cleared() { _spec.ClearField(matchplayer.FieldMk2, field.TypeUint) } if value, ok := mpuo.mutation.Mk3(); ok { _spec.SetField(matchplayer.FieldMk3, field.TypeUint, value) } if value, ok := mpuo.mutation.AddedMk3(); ok { _spec.AddField(matchplayer.FieldMk3, field.TypeUint, value) } if mpuo.mutation.Mk3Cleared() { _spec.ClearField(matchplayer.FieldMk3, field.TypeUint) } if value, ok := mpuo.mutation.Mk4(); ok { _spec.SetField(matchplayer.FieldMk4, field.TypeUint, value) } if value, ok := mpuo.mutation.AddedMk4(); ok { _spec.AddField(matchplayer.FieldMk4, field.TypeUint, value) } if mpuo.mutation.Mk4Cleared() { _spec.ClearField(matchplayer.FieldMk4, field.TypeUint) } if value, ok := mpuo.mutation.Mk5(); ok { _spec.SetField(matchplayer.FieldMk5, field.TypeUint, value) } if value, ok := mpuo.mutation.AddedMk5(); ok { _spec.AddField(matchplayer.FieldMk5, field.TypeUint, value) } if mpuo.mutation.Mk5Cleared() { _spec.ClearField(matchplayer.FieldMk5, field.TypeUint) } if value, ok := mpuo.mutation.DmgEnemy(); ok { _spec.SetField(matchplayer.FieldDmgEnemy, field.TypeUint, value) } if value, ok := mpuo.mutation.AddedDmgEnemy(); ok { _spec.AddField(matchplayer.FieldDmgEnemy, field.TypeUint, value) } if mpuo.mutation.DmgEnemyCleared() { _spec.ClearField(matchplayer.FieldDmgEnemy, field.TypeUint) } if value, ok := mpuo.mutation.DmgTeam(); ok { _spec.SetField(matchplayer.FieldDmgTeam, field.TypeUint, value) } if value, ok := mpuo.mutation.AddedDmgTeam(); ok { _spec.AddField(matchplayer.FieldDmgTeam, field.TypeUint, value) } if mpuo.mutation.DmgTeamCleared() { _spec.ClearField(matchplayer.FieldDmgTeam, field.TypeUint) } if value, ok := mpuo.mutation.UdHe(); ok { _spec.SetField(matchplayer.FieldUdHe, field.TypeUint, value) } if value, ok := mpuo.mutation.AddedUdHe(); ok { _spec.AddField(matchplayer.FieldUdHe, field.TypeUint, value) } if mpuo.mutation.UdHeCleared() { _spec.ClearField(matchplayer.FieldUdHe, field.TypeUint) } if value, ok := mpuo.mutation.UdFlames(); ok { _spec.SetField(matchplayer.FieldUdFlames, field.TypeUint, value) } if value, ok := mpuo.mutation.AddedUdFlames(); ok { _spec.AddField(matchplayer.FieldUdFlames, field.TypeUint, value) } if mpuo.mutation.UdFlamesCleared() { _spec.ClearField(matchplayer.FieldUdFlames, field.TypeUint) } if value, ok := mpuo.mutation.UdFlash(); ok { _spec.SetField(matchplayer.FieldUdFlash, field.TypeUint, value) } if value, ok := mpuo.mutation.AddedUdFlash(); ok { _spec.AddField(matchplayer.FieldUdFlash, field.TypeUint, value) } if mpuo.mutation.UdFlashCleared() { _spec.ClearField(matchplayer.FieldUdFlash, field.TypeUint) } if value, ok := mpuo.mutation.UdDecoy(); ok { _spec.SetField(matchplayer.FieldUdDecoy, field.TypeUint, value) } if value, ok := mpuo.mutation.AddedUdDecoy(); ok { _spec.AddField(matchplayer.FieldUdDecoy, field.TypeUint, value) } if mpuo.mutation.UdDecoyCleared() { _spec.ClearField(matchplayer.FieldUdDecoy, field.TypeUint) } if value, ok := mpuo.mutation.UdSmoke(); ok { _spec.SetField(matchplayer.FieldUdSmoke, field.TypeUint, value) } if value, ok := mpuo.mutation.AddedUdSmoke(); ok { _spec.AddField(matchplayer.FieldUdSmoke, field.TypeUint, value) } if mpuo.mutation.UdSmokeCleared() { _spec.ClearField(matchplayer.FieldUdSmoke, field.TypeUint) } if value, ok := mpuo.mutation.Crosshair(); ok { _spec.SetField(matchplayer.FieldCrosshair, field.TypeString, value) } if mpuo.mutation.CrosshairCleared() { _spec.ClearField(matchplayer.FieldCrosshair, field.TypeString) } if value, ok := mpuo.mutation.Color(); ok { _spec.SetField(matchplayer.FieldColor, field.TypeEnum, value) } if mpuo.mutation.ColorCleared() { _spec.ClearField(matchplayer.FieldColor, field.TypeEnum) } if value, ok := mpuo.mutation.Kast(); ok { _spec.SetField(matchplayer.FieldKast, field.TypeInt, value) } if value, ok := mpuo.mutation.AddedKast(); ok { _spec.AddField(matchplayer.FieldKast, field.TypeInt, value) } if mpuo.mutation.KastCleared() { _spec.ClearField(matchplayer.FieldKast, field.TypeInt) } if value, ok := mpuo.mutation.FlashDurationSelf(); ok { _spec.SetField(matchplayer.FieldFlashDurationSelf, field.TypeFloat32, value) } if value, ok := mpuo.mutation.AddedFlashDurationSelf(); ok { _spec.AddField(matchplayer.FieldFlashDurationSelf, field.TypeFloat32, value) } if mpuo.mutation.FlashDurationSelfCleared() { _spec.ClearField(matchplayer.FieldFlashDurationSelf, field.TypeFloat32) } if value, ok := mpuo.mutation.FlashDurationTeam(); ok { _spec.SetField(matchplayer.FieldFlashDurationTeam, field.TypeFloat32, value) } if value, ok := mpuo.mutation.AddedFlashDurationTeam(); ok { _spec.AddField(matchplayer.FieldFlashDurationTeam, field.TypeFloat32, value) } if mpuo.mutation.FlashDurationTeamCleared() { _spec.ClearField(matchplayer.FieldFlashDurationTeam, field.TypeFloat32) } if value, ok := mpuo.mutation.FlashDurationEnemy(); ok { _spec.SetField(matchplayer.FieldFlashDurationEnemy, field.TypeFloat32, value) } if value, ok := mpuo.mutation.AddedFlashDurationEnemy(); ok { _spec.AddField(matchplayer.FieldFlashDurationEnemy, field.TypeFloat32, value) } if mpuo.mutation.FlashDurationEnemyCleared() { _spec.ClearField(matchplayer.FieldFlashDurationEnemy, field.TypeFloat32) } if value, ok := mpuo.mutation.FlashTotalSelf(); ok { _spec.SetField(matchplayer.FieldFlashTotalSelf, field.TypeUint, value) } if value, ok := mpuo.mutation.AddedFlashTotalSelf(); ok { _spec.AddField(matchplayer.FieldFlashTotalSelf, field.TypeUint, value) } if mpuo.mutation.FlashTotalSelfCleared() { _spec.ClearField(matchplayer.FieldFlashTotalSelf, field.TypeUint) } if value, ok := mpuo.mutation.FlashTotalTeam(); ok { _spec.SetField(matchplayer.FieldFlashTotalTeam, field.TypeUint, value) } if value, ok := mpuo.mutation.AddedFlashTotalTeam(); ok { _spec.AddField(matchplayer.FieldFlashTotalTeam, field.TypeUint, value) } if mpuo.mutation.FlashTotalTeamCleared() { _spec.ClearField(matchplayer.FieldFlashTotalTeam, field.TypeUint) } if value, ok := mpuo.mutation.FlashTotalEnemy(); ok { _spec.SetField(matchplayer.FieldFlashTotalEnemy, field.TypeUint, value) } if value, ok := mpuo.mutation.AddedFlashTotalEnemy(); ok { _spec.AddField(matchplayer.FieldFlashTotalEnemy, field.TypeUint, value) } if mpuo.mutation.FlashTotalEnemyCleared() { _spec.ClearField(matchplayer.FieldFlashTotalEnemy, field.TypeUint) } if value, ok := mpuo.mutation.FlashAssists(); ok { _spec.SetField(matchplayer.FieldFlashAssists, field.TypeInt, value) } if value, ok := mpuo.mutation.AddedFlashAssists(); ok { _spec.AddField(matchplayer.FieldFlashAssists, field.TypeInt, value) } if mpuo.mutation.FlashAssistsCleared() { _spec.ClearField(matchplayer.FieldFlashAssists, field.TypeInt) } if value, ok := mpuo.mutation.AvgPing(); ok { _spec.SetField(matchplayer.FieldAvgPing, field.TypeFloat64, value) } if value, ok := mpuo.mutation.AddedAvgPing(); ok { _spec.AddField(matchplayer.FieldAvgPing, field.TypeFloat64, value) } if mpuo.mutation.AvgPingCleared() { _spec.ClearField(matchplayer.FieldAvgPing, field.TypeFloat64) } if mpuo.mutation.MatchesCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, Table: matchplayer.MatchesTable, Columns: []string{matchplayer.MatchesColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: &sqlgraph.FieldSpec{ Type: field.TypeUint64, Column: match.FieldID, }, }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := mpuo.mutation.MatchesIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, Table: matchplayer.MatchesTable, Columns: []string{matchplayer.MatchesColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: &sqlgraph.FieldSpec{ Type: field.TypeUint64, Column: match.FieldID, }, }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } if mpuo.mutation.PlayersCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, Table: matchplayer.PlayersTable, Columns: []string{matchplayer.PlayersColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: &sqlgraph.FieldSpec{ Type: field.TypeUint64, Column: player.FieldID, }, }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := mpuo.mutation.PlayersIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, Table: matchplayer.PlayersTable, Columns: []string{matchplayer.PlayersColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: &sqlgraph.FieldSpec{ Type: field.TypeUint64, Column: player.FieldID, }, }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } if mpuo.mutation.WeaponStatsCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: matchplayer.WeaponStatsTable, Columns: []string{matchplayer.WeaponStatsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: &sqlgraph.FieldSpec{ Type: field.TypeInt, Column: weapon.FieldID, }, }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := mpuo.mutation.RemovedWeaponStatsIDs(); len(nodes) > 0 && !mpuo.mutation.WeaponStatsCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: matchplayer.WeaponStatsTable, Columns: []string{matchplayer.WeaponStatsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: &sqlgraph.FieldSpec{ Type: field.TypeInt, Column: weapon.FieldID, }, }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := mpuo.mutation.WeaponStatsIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: matchplayer.WeaponStatsTable, Columns: []string{matchplayer.WeaponStatsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: &sqlgraph.FieldSpec{ Type: field.TypeInt, Column: weapon.FieldID, }, }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } if mpuo.mutation.RoundStatsCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: matchplayer.RoundStatsTable, Columns: []string{matchplayer.RoundStatsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: &sqlgraph.FieldSpec{ Type: field.TypeInt, Column: roundstats.FieldID, }, }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := mpuo.mutation.RemovedRoundStatsIDs(); len(nodes) > 0 && !mpuo.mutation.RoundStatsCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: matchplayer.RoundStatsTable, Columns: []string{matchplayer.RoundStatsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: &sqlgraph.FieldSpec{ Type: field.TypeInt, Column: roundstats.FieldID, }, }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := mpuo.mutation.RoundStatsIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: matchplayer.RoundStatsTable, Columns: []string{matchplayer.RoundStatsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: &sqlgraph.FieldSpec{ Type: field.TypeInt, Column: roundstats.FieldID, }, }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } if mpuo.mutation.SprayCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: matchplayer.SprayTable, Columns: []string{matchplayer.SprayColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: &sqlgraph.FieldSpec{ Type: field.TypeInt, Column: spray.FieldID, }, }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := mpuo.mutation.RemovedSprayIDs(); len(nodes) > 0 && !mpuo.mutation.SprayCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: matchplayer.SprayTable, Columns: []string{matchplayer.SprayColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: &sqlgraph.FieldSpec{ Type: field.TypeInt, Column: spray.FieldID, }, }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := mpuo.mutation.SprayIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: matchplayer.SprayTable, Columns: []string{matchplayer.SprayColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: &sqlgraph.FieldSpec{ Type: field.TypeInt, Column: spray.FieldID, }, }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } if mpuo.mutation.MessagesCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: matchplayer.MessagesTable, Columns: []string{matchplayer.MessagesColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: &sqlgraph.FieldSpec{ Type: field.TypeInt, Column: messages.FieldID, }, }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := mpuo.mutation.RemovedMessagesIDs(); len(nodes) > 0 && !mpuo.mutation.MessagesCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: matchplayer.MessagesTable, Columns: []string{matchplayer.MessagesColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: &sqlgraph.FieldSpec{ Type: field.TypeInt, Column: messages.FieldID, }, }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := mpuo.mutation.MessagesIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: matchplayer.MessagesTable, Columns: []string{matchplayer.MessagesColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: &sqlgraph.FieldSpec{ Type: field.TypeInt, Column: messages.FieldID, }, }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } _spec.AddModifiers(mpuo.modifiers...) _node = &MatchPlayer{config: mpuo.config} _spec.Assign = _node.assignValues _spec.ScanValues = _node.scanValues if err = sqlgraph.UpdateNode(ctx, mpuo.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{matchplayer.Label} } else if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } return nil, err } mpuo.mutation.done = true return _node, nil }