refactored some functions, added demo download retry
This commit is contained in:
@@ -49,7 +49,6 @@ type MatchMutation struct {
|
||||
addmatch_result *int
|
||||
max_rounds *int
|
||||
addmax_rounds *int
|
||||
demo_expired *bool
|
||||
demo_parsed *bool
|
||||
eco *struct {
|
||||
Rounds []*struct {
|
||||
@@ -605,42 +604,6 @@ func (m *MatchMutation) ResetMaxRounds() {
|
||||
m.addmax_rounds = nil
|
||||
}
|
||||
|
||||
// SetDemoExpired sets the "demo_expired" field.
|
||||
func (m *MatchMutation) SetDemoExpired(b bool) {
|
||||
m.demo_expired = &b
|
||||
}
|
||||
|
||||
// DemoExpired returns the value of the "demo_expired" field in the mutation.
|
||||
func (m *MatchMutation) DemoExpired() (r bool, exists bool) {
|
||||
v := m.demo_expired
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldDemoExpired returns the old "demo_expired" 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) OldDemoExpired(ctx context.Context) (v bool, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, fmt.Errorf("OldDemoExpired is only allowed on UpdateOne operations")
|
||||
}
|
||||
if m.id == nil || m.oldValue == nil {
|
||||
return v, fmt.Errorf("OldDemoExpired requires an ID field in the mutation")
|
||||
}
|
||||
oldValue, err := m.oldValue(ctx)
|
||||
if err != nil {
|
||||
return v, fmt.Errorf("querying old value for OldDemoExpired: %w", err)
|
||||
}
|
||||
return oldValue.DemoExpired, nil
|
||||
}
|
||||
|
||||
// ResetDemoExpired resets all changes to the "demo_expired" field.
|
||||
func (m *MatchMutation) ResetDemoExpired() {
|
||||
m.demo_expired = nil
|
||||
}
|
||||
|
||||
// SetDemoParsed sets the "demo_parsed" field.
|
||||
func (m *MatchMutation) SetDemoParsed(b bool) {
|
||||
m.demo_parsed = &b
|
||||
@@ -871,7 +834,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, 11)
|
||||
if m.share_code != nil {
|
||||
fields = append(fields, match.FieldShareCode)
|
||||
}
|
||||
@@ -899,9 +862,6 @@ func (m *MatchMutation) Fields() []string {
|
||||
if m.max_rounds != nil {
|
||||
fields = append(fields, match.FieldMaxRounds)
|
||||
}
|
||||
if m.demo_expired != nil {
|
||||
fields = append(fields, match.FieldDemoExpired)
|
||||
}
|
||||
if m.demo_parsed != nil {
|
||||
fields = append(fields, match.FieldDemoParsed)
|
||||
}
|
||||
@@ -934,8 +894,6 @@ func (m *MatchMutation) Field(name string) (ent.Value, bool) {
|
||||
return m.MatchResult()
|
||||
case match.FieldMaxRounds:
|
||||
return m.MaxRounds()
|
||||
case match.FieldDemoExpired:
|
||||
return m.DemoExpired()
|
||||
case match.FieldDemoParsed:
|
||||
return m.DemoParsed()
|
||||
case match.FieldEco:
|
||||
@@ -967,8 +925,6 @@ 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.FieldDemoExpired:
|
||||
return m.OldDemoExpired(ctx)
|
||||
case match.FieldDemoParsed:
|
||||
return m.OldDemoParsed(ctx)
|
||||
case match.FieldEco:
|
||||
@@ -1045,13 +1001,6 @@ func (m *MatchMutation) SetField(name string, value ent.Value) error {
|
||||
}
|
||||
m.SetMaxRounds(v)
|
||||
return nil
|
||||
case match.FieldDemoExpired:
|
||||
v, ok := value.(bool)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
m.SetDemoExpired(v)
|
||||
return nil
|
||||
case match.FieldDemoParsed:
|
||||
v, ok := value.(bool)
|
||||
if !ok {
|
||||
@@ -1232,9 +1181,6 @@ func (m *MatchMutation) ResetField(name string) error {
|
||||
case match.FieldMaxRounds:
|
||||
m.ResetMaxRounds()
|
||||
return nil
|
||||
case match.FieldDemoExpired:
|
||||
m.ResetDemoExpired()
|
||||
return nil
|
||||
case match.FieldDemoParsed:
|
||||
m.ResetDemoParsed()
|
||||
return nil
|
||||
|
Reference in New Issue
Block a user