return color by string, added rounds since maxrounds is not defined in pre-riptide matches
This commit is contained in:
@@ -49,6 +49,8 @@ type MatchMutation struct {
|
||||
addmatch_result *int
|
||||
max_rounds *int
|
||||
addmax_rounds *int
|
||||
rounds *int
|
||||
addrounds *int
|
||||
demo_expired *bool
|
||||
demo_parsed *bool
|
||||
eco *struct {
|
||||
@@ -605,6 +607,62 @@ func (m *MatchMutation) ResetMaxRounds() {
|
||||
m.addmax_rounds = nil
|
||||
}
|
||||
|
||||
// SetRounds sets the "rounds" field.
|
||||
func (m *MatchMutation) SetRounds(i int) {
|
||||
m.rounds = &i
|
||||
m.addrounds = nil
|
||||
}
|
||||
|
||||
// Rounds returns the value of the "rounds" field in the mutation.
|
||||
func (m *MatchMutation) Rounds() (r int, exists bool) {
|
||||
v := m.rounds
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldRounds returns the old "rounds" field's value of the Match entity.
|
||||
// If the Match object wasn't provided to the builder, the object is fetched from the database.
|
||||
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
|
||||
func (m *MatchMutation) OldRounds(ctx context.Context) (v int, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, fmt.Errorf("OldRounds is only allowed on UpdateOne operations")
|
||||
}
|
||||
if m.id == nil || m.oldValue == nil {
|
||||
return v, fmt.Errorf("OldRounds requires an ID field in the mutation")
|
||||
}
|
||||
oldValue, err := m.oldValue(ctx)
|
||||
if err != nil {
|
||||
return v, fmt.Errorf("querying old value for OldRounds: %w", err)
|
||||
}
|
||||
return oldValue.Rounds, nil
|
||||
}
|
||||
|
||||
// AddRounds adds i to the "rounds" field.
|
||||
func (m *MatchMutation) AddRounds(i int) {
|
||||
if m.addrounds != nil {
|
||||
*m.addrounds += i
|
||||
} else {
|
||||
m.addrounds = &i
|
||||
}
|
||||
}
|
||||
|
||||
// AddedRounds returns the value that was added to the "rounds" field in this mutation.
|
||||
func (m *MatchMutation) AddedRounds() (r int, exists bool) {
|
||||
v := m.addrounds
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// ResetRounds resets all changes to the "rounds" field.
|
||||
func (m *MatchMutation) ResetRounds() {
|
||||
m.rounds = nil
|
||||
m.addrounds = nil
|
||||
}
|
||||
|
||||
// SetDemoExpired sets the "demo_expired" field.
|
||||
func (m *MatchMutation) SetDemoExpired(b bool) {
|
||||
m.demo_expired = &b
|
||||
@@ -871,7 +929,7 @@ func (m *MatchMutation) Type() string {
|
||||
// order to get all numeric fields that were incremented/decremented, call
|
||||
// AddedFields().
|
||||
func (m *MatchMutation) Fields() []string {
|
||||
fields := make([]string, 0, 12)
|
||||
fields := make([]string, 0, 13)
|
||||
if m.share_code != nil {
|
||||
fields = append(fields, match.FieldShareCode)
|
||||
}
|
||||
@@ -899,6 +957,9 @@ func (m *MatchMutation) Fields() []string {
|
||||
if m.max_rounds != nil {
|
||||
fields = append(fields, match.FieldMaxRounds)
|
||||
}
|
||||
if m.rounds != nil {
|
||||
fields = append(fields, match.FieldRounds)
|
||||
}
|
||||
if m.demo_expired != nil {
|
||||
fields = append(fields, match.FieldDemoExpired)
|
||||
}
|
||||
@@ -934,6 +995,8 @@ func (m *MatchMutation) Field(name string) (ent.Value, bool) {
|
||||
return m.MatchResult()
|
||||
case match.FieldMaxRounds:
|
||||
return m.MaxRounds()
|
||||
case match.FieldRounds:
|
||||
return m.Rounds()
|
||||
case match.FieldDemoExpired:
|
||||
return m.DemoExpired()
|
||||
case match.FieldDemoParsed:
|
||||
@@ -967,6 +1030,8 @@ func (m *MatchMutation) OldField(ctx context.Context, name string) (ent.Value, e
|
||||
return m.OldMatchResult(ctx)
|
||||
case match.FieldMaxRounds:
|
||||
return m.OldMaxRounds(ctx)
|
||||
case match.FieldRounds:
|
||||
return m.OldRounds(ctx)
|
||||
case match.FieldDemoExpired:
|
||||
return m.OldDemoExpired(ctx)
|
||||
case match.FieldDemoParsed:
|
||||
@@ -1045,6 +1110,13 @@ func (m *MatchMutation) SetField(name string, value ent.Value) error {
|
||||
}
|
||||
m.SetMaxRounds(v)
|
||||
return nil
|
||||
case match.FieldRounds:
|
||||
v, ok := value.(int)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
m.SetRounds(v)
|
||||
return nil
|
||||
case match.FieldDemoExpired:
|
||||
v, ok := value.(bool)
|
||||
if !ok {
|
||||
@@ -1095,6 +1167,9 @@ func (m *MatchMutation) AddedFields() []string {
|
||||
if m.addmax_rounds != nil {
|
||||
fields = append(fields, match.FieldMaxRounds)
|
||||
}
|
||||
if m.addrounds != nil {
|
||||
fields = append(fields, match.FieldRounds)
|
||||
}
|
||||
return fields
|
||||
}
|
||||
|
||||
@@ -1113,6 +1188,8 @@ func (m *MatchMutation) AddedField(name string) (ent.Value, bool) {
|
||||
return m.AddedMatchResult()
|
||||
case match.FieldMaxRounds:
|
||||
return m.AddedMaxRounds()
|
||||
case match.FieldRounds:
|
||||
return m.AddedRounds()
|
||||
}
|
||||
return nil, false
|
||||
}
|
||||
@@ -1157,6 +1234,13 @@ func (m *MatchMutation) AddField(name string, value ent.Value) error {
|
||||
}
|
||||
m.AddMaxRounds(v)
|
||||
return nil
|
||||
case match.FieldRounds:
|
||||
v, ok := value.(int)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
m.AddRounds(v)
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("unknown Match numeric field %s", name)
|
||||
}
|
||||
@@ -1232,6 +1316,9 @@ func (m *MatchMutation) ResetField(name string) error {
|
||||
case match.FieldMaxRounds:
|
||||
m.ResetMaxRounds()
|
||||
return nil
|
||||
case match.FieldRounds:
|
||||
m.ResetRounds()
|
||||
return nil
|
||||
case match.FieldDemoExpired:
|
||||
m.ResetDemoExpired()
|
||||
return nil
|
||||
@@ -2556,7 +2643,7 @@ type StatsMutation struct {
|
||||
} "json:\"hit_group,omitempty\""
|
||||
} "json:\"dmg,omitempty\""
|
||||
Crosshair string "json:\"crosshair,omitempty\""
|
||||
Color int "json:\"color,omitempty\""
|
||||
Color string "json:\"color,omitempty\""
|
||||
KAST int "json:\"kast,omitempty\""
|
||||
Rank struct {
|
||||
Old int "json:\"old,omitempty\""
|
||||
@@ -3086,7 +3173,7 @@ func (m *StatsMutation) SetExtended(skkgaaaallllg struct {
|
||||
} "json:\"hit_group,omitempty\""
|
||||
} "json:\"dmg,omitempty\""
|
||||
Crosshair string "json:\"crosshair,omitempty\""
|
||||
Color int "json:\"color,omitempty\""
|
||||
Color string "json:\"color,omitempty\""
|
||||
KAST int "json:\"kast,omitempty\""
|
||||
Rank struct {
|
||||
Old int "json:\"old,omitempty\""
|
||||
@@ -3138,7 +3225,7 @@ func (m *StatsMutation) Extended() (r struct {
|
||||
} "json:\"hit_group,omitempty\""
|
||||
} "json:\"dmg,omitempty\""
|
||||
Crosshair string "json:\"crosshair,omitempty\""
|
||||
Color int "json:\"color,omitempty\""
|
||||
Color string "json:\"color,omitempty\""
|
||||
KAST int "json:\"kast,omitempty\""
|
||||
Rank struct {
|
||||
Old int "json:\"old,omitempty\""
|
||||
@@ -3196,7 +3283,7 @@ func (m *StatsMutation) OldExtended(ctx context.Context) (v struct {
|
||||
} "json:\"hit_group,omitempty\""
|
||||
} "json:\"dmg,omitempty\""
|
||||
Crosshair string "json:\"crosshair,omitempty\""
|
||||
Color int "json:\"color,omitempty\""
|
||||
Color string "json:\"color,omitempty\""
|
||||
KAST int "json:\"kast,omitempty\""
|
||||
Rank struct {
|
||||
Old int "json:\"old,omitempty\""
|
||||
@@ -3505,7 +3592,7 @@ func (m *StatsMutation) SetField(name string, value ent.Value) error {
|
||||
} "json:\"hit_group,omitempty\""
|
||||
} "json:\"dmg,omitempty\""
|
||||
Crosshair string "json:\"crosshair,omitempty\""
|
||||
Color int "json:\"color,omitempty\""
|
||||
Color string "json:\"color,omitempty\""
|
||||
KAST int "json:\"kast,omitempty\""
|
||||
Rank struct {
|
||||
Old int "json:\"old,omitempty\""
|
||||
|
Reference in New Issue
Block a user