return color by string, added rounds since maxrounds is not defined in pre-riptide matches

This commit is contained in:
2021-10-08 20:59:14 +02:00
parent cc48365eea
commit cce5c5d072
17 changed files with 283 additions and 18 deletions

View File

@@ -146,6 +146,19 @@ func (mu *MatchUpdate) AddMaxRounds(i int) *MatchUpdate {
return mu
}
// SetRounds sets the "rounds" field.
func (mu *MatchUpdate) SetRounds(i int) *MatchUpdate {
mu.mutation.ResetRounds()
mu.mutation.SetRounds(i)
return mu
}
// AddRounds adds i to the "rounds" field.
func (mu *MatchUpdate) AddRounds(i int) *MatchUpdate {
mu.mutation.AddRounds(i)
return mu
}
// SetDemoExpired sets the "demo_expired" field.
func (mu *MatchUpdate) SetDemoExpired(b bool) *MatchUpdate {
mu.mutation.SetDemoExpired(b)
@@ -465,6 +478,20 @@ func (mu *MatchUpdate) sqlSave(ctx context.Context) (n int, err error) {
Column: match.FieldMaxRounds,
})
}
if value, ok := mu.mutation.Rounds(); ok {
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
Type: field.TypeInt,
Value: value,
Column: match.FieldRounds,
})
}
if value, ok := mu.mutation.AddedRounds(); ok {
_spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{
Type: field.TypeInt,
Value: value,
Column: match.FieldRounds,
})
}
if value, ok := mu.mutation.DemoExpired(); ok {
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
Type: field.TypeBool,
@@ -736,6 +763,19 @@ func (muo *MatchUpdateOne) AddMaxRounds(i int) *MatchUpdateOne {
return muo
}
// SetRounds sets the "rounds" field.
func (muo *MatchUpdateOne) SetRounds(i int) *MatchUpdateOne {
muo.mutation.ResetRounds()
muo.mutation.SetRounds(i)
return muo
}
// AddRounds adds i to the "rounds" field.
func (muo *MatchUpdateOne) AddRounds(i int) *MatchUpdateOne {
muo.mutation.AddRounds(i)
return muo
}
// SetDemoExpired sets the "demo_expired" field.
func (muo *MatchUpdateOne) SetDemoExpired(b bool) *MatchUpdateOne {
muo.mutation.SetDemoExpired(b)
@@ -1079,6 +1119,20 @@ func (muo *MatchUpdateOne) sqlSave(ctx context.Context) (_node *Match, err error
Column: match.FieldMaxRounds,
})
}
if value, ok := muo.mutation.Rounds(); ok {
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
Type: field.TypeInt,
Value: value,
Column: match.FieldRounds,
})
}
if value, ok := muo.mutation.AddedRounds(); ok {
_spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{
Type: field.TypeInt,
Value: value,
Column: match.FieldRounds,
})
}
if value, ok := muo.mutation.DemoExpired(); ok {
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
Type: field.TypeBool,