refactored some functions, added demo download retry

This commit is contained in:
2021-10-09 19:10:38 +02:00
parent 15b273f052
commit e938b05f52
13 changed files with 242 additions and 322 deletions

View File

@@ -35,8 +35,6 @@ type Match struct {
MatchResult int `json:"match_result,omitempty"`
// MaxRounds holds the value of the "max_rounds" field.
MaxRounds int `json:"max_rounds,omitempty"`
// DemoExpired holds the value of the "demo_expired" field.
DemoExpired bool `json:"demo_expired,omitempty"`
// DemoParsed holds the value of the "demo_parsed" field.
DemoParsed bool `json:"demo_parsed,omitempty"`
// Eco holds the value of the "eco" field.
@@ -88,7 +86,7 @@ func (*Match) scanValues(columns []string) ([]interface{}, error) {
switch columns[i] {
case match.FieldEco:
values[i] = new([]byte)
case match.FieldDemoExpired, match.FieldDemoParsed:
case match.FieldDemoParsed:
values[i] = new(sql.NullBool)
case match.FieldID, match.FieldScoreTeamA, match.FieldScoreTeamB, match.FieldDuration, match.FieldMatchResult, match.FieldMaxRounds:
values[i] = new(sql.NullInt64)
@@ -171,12 +169,6 @@ func (m *Match) assignValues(columns []string, values []interface{}) error {
} else if value.Valid {
m.MaxRounds = int(value.Int64)
}
case match.FieldDemoExpired:
if value, ok := values[i].(*sql.NullBool); !ok {
return fmt.Errorf("unexpected type %T for field demo_expired", values[i])
} else if value.Valid {
m.DemoExpired = value.Bool
}
case match.FieldDemoParsed:
if value, ok := values[i].(*sql.NullBool); !ok {
return fmt.Errorf("unexpected type %T for field demo_parsed", values[i])
@@ -247,8 +239,6 @@ func (m *Match) String() string {
builder.WriteString(fmt.Sprintf("%v", m.MatchResult))
builder.WriteString(", max_rounds=")
builder.WriteString(fmt.Sprintf("%v", m.MaxRounds))
builder.WriteString(", demo_expired=")
builder.WriteString(fmt.Sprintf("%v", m.DemoExpired))
builder.WriteString(", demo_parsed=")
builder.WriteString(fmt.Sprintf("%v", m.DemoParsed))
builder.WriteString(", eco=")