tracking tickrate

This commit is contained in:
2022-02-03 16:27:29 +01:00
parent ff0ea43cea
commit 182c7d8fc1
12 changed files with 352 additions and 3 deletions

View File

@@ -42,6 +42,8 @@ type Match struct {
GamebanPresent bool `json:"gameban_present,omitempty"`
// DecryptionKey holds the value of the "decryption_key" field.
DecryptionKey []byte `json:"decryption_key,omitempty"`
// TickRate holds the value of the "tick_rate" field.
TickRate float64 `json:"tick_rate,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"`
@@ -85,6 +87,8 @@ func (*Match) scanValues(columns []string) ([]interface{}, error) {
values[i] = new([]byte)
case match.FieldDemoParsed, match.FieldVacPresent, match.FieldGamebanPresent:
values[i] = new(sql.NullBool)
case match.FieldTickRate:
values[i] = new(sql.NullFloat64)
case match.FieldID, match.FieldScoreTeamA, match.FieldScoreTeamB, match.FieldDuration, match.FieldMatchResult, match.FieldMaxRounds:
values[i] = new(sql.NullInt64)
case match.FieldShareCode, match.FieldMap, match.FieldReplayURL:
@@ -190,6 +194,12 @@ func (m *Match) assignValues(columns []string, values []interface{}) error {
} else if value != nil {
m.DecryptionKey = *value
}
case match.FieldTickRate:
if value, ok := values[i].(*sql.NullFloat64); !ok {
return fmt.Errorf("unexpected type %T for field tick_rate", values[i])
} else if value.Valid {
m.TickRate = value.Float64
}
}
}
return nil
@@ -254,6 +264,8 @@ func (m *Match) String() string {
builder.WriteString(fmt.Sprintf("%v", m.GamebanPresent))
builder.WriteString(", decryption_key=")
builder.WriteString(fmt.Sprintf("%v", m.DecryptionKey))
builder.WriteString(", tick_rate=")
builder.WriteString(fmt.Sprintf("%v", m.TickRate))
builder.WriteByte(')')
return builder.String()
}