added vac/gameban marker for matches

This commit is contained in:
2021-10-28 08:47:41 +02:00
parent 25b153900f
commit 37233be336
14 changed files with 371 additions and 10 deletions

View File

@@ -36,6 +36,10 @@ type Match struct {
MaxRounds int `json:"max_rounds,omitempty"`
// DemoParsed holds the value of the "demo_parsed" field.
DemoParsed bool `json:"demo_parsed,omitempty"`
// VacPresent holds the value of the "vac_present" field.
VacPresent bool `json:"vac_present,omitempty"`
// GamebanPresent holds the value of the "gameban_present" field.
GamebanPresent bool `json:"gameban_present,omitempty"`
// Edges holds the relations/edges for other nodes in the graph.
// The values are being populated by the MatchQuery when eager-loading is set.
Edges MatchEdges `json:"edges"`
@@ -75,7 +79,7 @@ func (*Match) scanValues(columns []string) ([]interface{}, error) {
values := make([]interface{}, len(columns))
for i := range columns {
switch columns[i] {
case match.FieldDemoParsed:
case match.FieldDemoParsed, match.FieldVacPresent, match.FieldGamebanPresent:
values[i] = new(sql.NullBool)
case match.FieldID, match.FieldScoreTeamA, match.FieldScoreTeamB, match.FieldDuration, match.FieldMatchResult, match.FieldMaxRounds:
values[i] = new(sql.NullInt64)
@@ -164,6 +168,18 @@ func (m *Match) assignValues(columns []string, values []interface{}) error {
} else if value.Valid {
m.DemoParsed = value.Bool
}
case match.FieldVacPresent:
if value, ok := values[i].(*sql.NullBool); !ok {
return fmt.Errorf("unexpected type %T for field vac_present", values[i])
} else if value.Valid {
m.VacPresent = value.Bool
}
case match.FieldGamebanPresent:
if value, ok := values[i].(*sql.NullBool); !ok {
return fmt.Errorf("unexpected type %T for field gameban_present", values[i])
} else if value.Valid {
m.GamebanPresent = value.Bool
}
}
}
return nil
@@ -222,6 +238,10 @@ func (m *Match) String() string {
builder.WriteString(fmt.Sprintf("%v", m.MaxRounds))
builder.WriteString(", demo_parsed=")
builder.WriteString(fmt.Sprintf("%v", m.DemoParsed))
builder.WriteString(", vac_present=")
builder.WriteString(fmt.Sprintf("%v", m.VacPresent))
builder.WriteString(", gameban_present=")
builder.WriteString(fmt.Sprintf("%v", m.GamebanPresent))
builder.WriteByte(')')
return builder.String()
}