added avg ping recording

This commit is contained in:
2022-12-29 18:47:37 +01:00
parent f6f73096e0
commit 0060e82aff
11 changed files with 334 additions and 20 deletions

View File

@@ -417,6 +417,20 @@ func (mpc *MatchPlayerCreate) SetNillableFlashAssists(i *int) *MatchPlayerCreate
return mpc
}
// SetAvgPing sets the "avg_ping" field.
func (mpc *MatchPlayerCreate) SetAvgPing(f float64) *MatchPlayerCreate {
mpc.mutation.SetAvgPing(f)
return mpc
}
// SetNillableAvgPing sets the "avg_ping" field if the given value is not nil.
func (mpc *MatchPlayerCreate) SetNillableAvgPing(f *float64) *MatchPlayerCreate {
if f != nil {
mpc.SetAvgPing(*f)
}
return mpc
}
// SetMatchesID sets the "matches" edge to the Match entity by ID.
func (mpc *MatchPlayerCreate) SetMatchesID(id uint64) *MatchPlayerCreate {
mpc.mutation.SetMatchesID(id)
@@ -764,6 +778,10 @@ func (mpc *MatchPlayerCreate) createSpec() (*MatchPlayer, *sqlgraph.CreateSpec)
_spec.SetField(matchplayer.FieldFlashAssists, field.TypeInt, value)
_node.FlashAssists = value
}
if value, ok := mpc.mutation.AvgPing(); ok {
_spec.SetField(matchplayer.FieldAvgPing, field.TypeFloat64, value)
_node.AvgPing = value
}
if nodes := mpc.mutation.MatchesIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,