removed unneeded field, fixed not setting spent amount
This commit is contained in:
@@ -374,7 +374,7 @@ func (p *DemoParser) parseWorker() {
|
|||||||
|
|
||||||
for _, eco := range ecoMap[tMatchPlayer.PlayerStats] {
|
for _, eco := range ecoMap[tMatchPlayer.PlayerStats] {
|
||||||
p.lock.Lock()
|
p.lock.Lock()
|
||||||
err := p.db.RoundStats.Create().SetStat(nMatchPLayer).SetRound(uint(eco.Round)).SetBank(uint(eco.Bank)).SetEquipment(uint(eco.EqV)).Exec(context.Background())
|
err := p.db.RoundStats.Create().SetStat(nMatchPLayer).SetRound(uint(eco.Round)).SetBank(uint(eco.Bank)).SetEquipment(uint(eco.EqV)).SetSpent(uint(eco.Spent)).Exec(context.Background())
|
||||||
p.lock.Unlock()
|
p.lock.Unlock()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Errorf("[DP] Unable to create WeaponStat: %v", err)
|
log.Errorf("[DP] Unable to create WeaponStat: %v", err)
|
||||||
|
21
ent/match.go
21
ent/match.go
@@ -4,7 +4,6 @@ package ent
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"csgowtfd/ent/match"
|
"csgowtfd/ent/match"
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
@@ -37,14 +36,6 @@ type Match struct {
|
|||||||
MaxRounds int `json:"max_rounds,omitempty"`
|
MaxRounds int `json:"max_rounds,omitempty"`
|
||||||
// DemoParsed holds the value of the "demo_parsed" field.
|
// DemoParsed holds the value of the "demo_parsed" field.
|
||||||
DemoParsed bool `json:"demo_parsed,omitempty"`
|
DemoParsed bool `json:"demo_parsed,omitempty"`
|
||||||
// Eco holds the value of the "eco" field.
|
|
||||||
Eco struct {
|
|
||||||
Rounds []*struct {
|
|
||||||
Team int "json:\"team\""
|
|
||||||
Bank int "json:\"bank\""
|
|
||||||
Equipment int "json:\"equipment\""
|
|
||||||
} "json:\"rounds\""
|
|
||||||
} `json:"eco,omitempty"`
|
|
||||||
// Edges holds the relations/edges for other nodes in the graph.
|
// Edges holds the relations/edges for other nodes in the graph.
|
||||||
// The values are being populated by the MatchQuery when eager-loading is set.
|
// The values are being populated by the MatchQuery when eager-loading is set.
|
||||||
Edges MatchEdges `json:"edges"`
|
Edges MatchEdges `json:"edges"`
|
||||||
@@ -84,8 +75,6 @@ func (*Match) scanValues(columns []string) ([]interface{}, error) {
|
|||||||
values := make([]interface{}, len(columns))
|
values := make([]interface{}, len(columns))
|
||||||
for i := range columns {
|
for i := range columns {
|
||||||
switch columns[i] {
|
switch columns[i] {
|
||||||
case match.FieldEco:
|
|
||||||
values[i] = new([]byte)
|
|
||||||
case match.FieldDemoParsed:
|
case match.FieldDemoParsed:
|
||||||
values[i] = new(sql.NullBool)
|
values[i] = new(sql.NullBool)
|
||||||
case match.FieldID, match.FieldScoreTeamA, match.FieldScoreTeamB, match.FieldDuration, match.FieldMatchResult, match.FieldMaxRounds:
|
case match.FieldID, match.FieldScoreTeamA, match.FieldScoreTeamB, match.FieldDuration, match.FieldMatchResult, match.FieldMaxRounds:
|
||||||
@@ -175,14 +164,6 @@ func (m *Match) assignValues(columns []string, values []interface{}) error {
|
|||||||
} else if value.Valid {
|
} else if value.Valid {
|
||||||
m.DemoParsed = value.Bool
|
m.DemoParsed = value.Bool
|
||||||
}
|
}
|
||||||
case match.FieldEco:
|
|
||||||
if value, ok := values[i].(*[]byte); !ok {
|
|
||||||
return fmt.Errorf("unexpected type %T for field eco", values[i])
|
|
||||||
} else if value != nil && len(*value) > 0 {
|
|
||||||
if err := json.Unmarshal(*value, &m.Eco); err != nil {
|
|
||||||
return fmt.Errorf("unmarshal field eco: %w", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
@@ -241,8 +222,6 @@ func (m *Match) String() string {
|
|||||||
builder.WriteString(fmt.Sprintf("%v", m.MaxRounds))
|
builder.WriteString(fmt.Sprintf("%v", m.MaxRounds))
|
||||||
builder.WriteString(", demo_parsed=")
|
builder.WriteString(", demo_parsed=")
|
||||||
builder.WriteString(fmt.Sprintf("%v", m.DemoParsed))
|
builder.WriteString(fmt.Sprintf("%v", m.DemoParsed))
|
||||||
builder.WriteString(", eco=")
|
|
||||||
builder.WriteString(fmt.Sprintf("%v", m.Eco))
|
|
||||||
builder.WriteByte(')')
|
builder.WriteByte(')')
|
||||||
return builder.String()
|
return builder.String()
|
||||||
}
|
}
|
||||||
|
@@ -27,8 +27,6 @@ const (
|
|||||||
FieldMaxRounds = "max_rounds"
|
FieldMaxRounds = "max_rounds"
|
||||||
// FieldDemoParsed holds the string denoting the demo_parsed field in the database.
|
// FieldDemoParsed holds the string denoting the demo_parsed field in the database.
|
||||||
FieldDemoParsed = "demo_parsed"
|
FieldDemoParsed = "demo_parsed"
|
||||||
// FieldEco holds the string denoting the eco field in the database.
|
|
||||||
FieldEco = "eco"
|
|
||||||
// EdgeStats holds the string denoting the stats edge name in mutations.
|
// EdgeStats holds the string denoting the stats edge name in mutations.
|
||||||
EdgeStats = "stats"
|
EdgeStats = "stats"
|
||||||
// EdgePlayers holds the string denoting the players edge name in mutations.
|
// EdgePlayers holds the string denoting the players edge name in mutations.
|
||||||
@@ -62,7 +60,6 @@ var Columns = []string{
|
|||||||
FieldMatchResult,
|
FieldMatchResult,
|
||||||
FieldMaxRounds,
|
FieldMaxRounds,
|
||||||
FieldDemoParsed,
|
FieldDemoParsed,
|
||||||
FieldEco,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@@ -994,20 +994,6 @@ func DemoParsedNEQ(v bool) predicate.Match {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// EcoIsNil applies the IsNil predicate on the "eco" field.
|
|
||||||
func EcoIsNil() predicate.Match {
|
|
||||||
return predicate.Match(func(s *sql.Selector) {
|
|
||||||
s.Where(sql.IsNull(s.C(FieldEco)))
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// EcoNotNil applies the NotNil predicate on the "eco" field.
|
|
||||||
func EcoNotNil() predicate.Match {
|
|
||||||
return predicate.Match(func(s *sql.Selector) {
|
|
||||||
s.Where(sql.NotNull(s.C(FieldEco)))
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// HasStats applies the HasEdge predicate on the "stats" edge.
|
// HasStats applies the HasEdge predicate on the "stats" edge.
|
||||||
func HasStats() predicate.Match {
|
func HasStats() predicate.Match {
|
||||||
return predicate.Match(func(s *sql.Selector) {
|
return predicate.Match(func(s *sql.Selector) {
|
||||||
|
@@ -106,32 +106,6 @@ func (mc *MatchCreate) SetNillableDemoParsed(b *bool) *MatchCreate {
|
|||||||
return mc
|
return mc
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetEco sets the "eco" field.
|
|
||||||
func (mc *MatchCreate) SetEco(s struct {
|
|
||||||
Rounds []*struct {
|
|
||||||
Team int "json:\"team\""
|
|
||||||
Bank int "json:\"bank\""
|
|
||||||
Equipment int "json:\"equipment\""
|
|
||||||
} "json:\"rounds\""
|
|
||||||
}) *MatchCreate {
|
|
||||||
mc.mutation.SetEco(s)
|
|
||||||
return mc
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetNillableEco sets the "eco" field if the given value is not nil.
|
|
||||||
func (mc *MatchCreate) SetNillableEco(s *struct {
|
|
||||||
Rounds []*struct {
|
|
||||||
Team int "json:\"team\""
|
|
||||||
Bank int "json:\"bank\""
|
|
||||||
Equipment int "json:\"equipment\""
|
|
||||||
} "json:\"rounds\""
|
|
||||||
}) *MatchCreate {
|
|
||||||
if s != nil {
|
|
||||||
mc.SetEco(*s)
|
|
||||||
}
|
|
||||||
return mc
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetID sets the "id" field.
|
// SetID sets the "id" field.
|
||||||
func (mc *MatchCreate) SetID(u uint64) *MatchCreate {
|
func (mc *MatchCreate) SetID(u uint64) *MatchCreate {
|
||||||
mc.mutation.SetID(u)
|
mc.mutation.SetID(u)
|
||||||
@@ -384,14 +358,6 @@ func (mc *MatchCreate) createSpec() (*Match, *sqlgraph.CreateSpec) {
|
|||||||
})
|
})
|
||||||
_node.DemoParsed = value
|
_node.DemoParsed = value
|
||||||
}
|
}
|
||||||
if value, ok := mc.mutation.Eco(); ok {
|
|
||||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
|
||||||
Type: field.TypeJSON,
|
|
||||||
Value: value,
|
|
||||||
Column: match.FieldEco,
|
|
||||||
})
|
|
||||||
_node.Eco = value
|
|
||||||
}
|
|
||||||
if nodes := mc.mutation.StatsIDs(); len(nodes) > 0 {
|
if nodes := mc.mutation.StatsIDs(); len(nodes) > 0 {
|
||||||
edge := &sqlgraph.EdgeSpec{
|
edge := &sqlgraph.EdgeSpec{
|
||||||
Rel: sqlgraph.O2M,
|
Rel: sqlgraph.O2M,
|
||||||
|
@@ -160,38 +160,6 @@ func (mu *MatchUpdate) SetNillableDemoParsed(b *bool) *MatchUpdate {
|
|||||||
return mu
|
return mu
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetEco sets the "eco" field.
|
|
||||||
func (mu *MatchUpdate) SetEco(s struct {
|
|
||||||
Rounds []*struct {
|
|
||||||
Team int "json:\"team\""
|
|
||||||
Bank int "json:\"bank\""
|
|
||||||
Equipment int "json:\"equipment\""
|
|
||||||
} "json:\"rounds\""
|
|
||||||
}) *MatchUpdate {
|
|
||||||
mu.mutation.SetEco(s)
|
|
||||||
return mu
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetNillableEco sets the "eco" field if the given value is not nil.
|
|
||||||
func (mu *MatchUpdate) SetNillableEco(s *struct {
|
|
||||||
Rounds []*struct {
|
|
||||||
Team int "json:\"team\""
|
|
||||||
Bank int "json:\"bank\""
|
|
||||||
Equipment int "json:\"equipment\""
|
|
||||||
} "json:\"rounds\""
|
|
||||||
}) *MatchUpdate {
|
|
||||||
if s != nil {
|
|
||||||
mu.SetEco(*s)
|
|
||||||
}
|
|
||||||
return mu
|
|
||||||
}
|
|
||||||
|
|
||||||
// ClearEco clears the value of the "eco" field.
|
|
||||||
func (mu *MatchUpdate) ClearEco() *MatchUpdate {
|
|
||||||
mu.mutation.ClearEco()
|
|
||||||
return mu
|
|
||||||
}
|
|
||||||
|
|
||||||
// AddStatIDs adds the "stats" edge to the Stats entity by IDs.
|
// AddStatIDs adds the "stats" edge to the Stats entity by IDs.
|
||||||
func (mu *MatchUpdate) AddStatIDs(ids ...int) *MatchUpdate {
|
func (mu *MatchUpdate) AddStatIDs(ids ...int) *MatchUpdate {
|
||||||
mu.mutation.AddStatIDs(ids...)
|
mu.mutation.AddStatIDs(ids...)
|
||||||
@@ -458,19 +426,6 @@ func (mu *MatchUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
|||||||
Column: match.FieldDemoParsed,
|
Column: match.FieldDemoParsed,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if value, ok := mu.mutation.Eco(); ok {
|
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
|
||||||
Type: field.TypeJSON,
|
|
||||||
Value: value,
|
|
||||||
Column: match.FieldEco,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
if mu.mutation.EcoCleared() {
|
|
||||||
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
|
||||||
Type: field.TypeJSON,
|
|
||||||
Column: match.FieldEco,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
if mu.mutation.StatsCleared() {
|
if mu.mutation.StatsCleared() {
|
||||||
edge := &sqlgraph.EdgeSpec{
|
edge := &sqlgraph.EdgeSpec{
|
||||||
Rel: sqlgraph.O2M,
|
Rel: sqlgraph.O2M,
|
||||||
@@ -729,38 +684,6 @@ func (muo *MatchUpdateOne) SetNillableDemoParsed(b *bool) *MatchUpdateOne {
|
|||||||
return muo
|
return muo
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetEco sets the "eco" field.
|
|
||||||
func (muo *MatchUpdateOne) SetEco(s struct {
|
|
||||||
Rounds []*struct {
|
|
||||||
Team int "json:\"team\""
|
|
||||||
Bank int "json:\"bank\""
|
|
||||||
Equipment int "json:\"equipment\""
|
|
||||||
} "json:\"rounds\""
|
|
||||||
}) *MatchUpdateOne {
|
|
||||||
muo.mutation.SetEco(s)
|
|
||||||
return muo
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetNillableEco sets the "eco" field if the given value is not nil.
|
|
||||||
func (muo *MatchUpdateOne) SetNillableEco(s *struct {
|
|
||||||
Rounds []*struct {
|
|
||||||
Team int "json:\"team\""
|
|
||||||
Bank int "json:\"bank\""
|
|
||||||
Equipment int "json:\"equipment\""
|
|
||||||
} "json:\"rounds\""
|
|
||||||
}) *MatchUpdateOne {
|
|
||||||
if s != nil {
|
|
||||||
muo.SetEco(*s)
|
|
||||||
}
|
|
||||||
return muo
|
|
||||||
}
|
|
||||||
|
|
||||||
// ClearEco clears the value of the "eco" field.
|
|
||||||
func (muo *MatchUpdateOne) ClearEco() *MatchUpdateOne {
|
|
||||||
muo.mutation.ClearEco()
|
|
||||||
return muo
|
|
||||||
}
|
|
||||||
|
|
||||||
// AddStatIDs adds the "stats" edge to the Stats entity by IDs.
|
// AddStatIDs adds the "stats" edge to the Stats entity by IDs.
|
||||||
func (muo *MatchUpdateOne) AddStatIDs(ids ...int) *MatchUpdateOne {
|
func (muo *MatchUpdateOne) AddStatIDs(ids ...int) *MatchUpdateOne {
|
||||||
muo.mutation.AddStatIDs(ids...)
|
muo.mutation.AddStatIDs(ids...)
|
||||||
@@ -1051,19 +974,6 @@ func (muo *MatchUpdateOne) sqlSave(ctx context.Context) (_node *Match, err error
|
|||||||
Column: match.FieldDemoParsed,
|
Column: match.FieldDemoParsed,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if value, ok := muo.mutation.Eco(); ok {
|
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
|
||||||
Type: field.TypeJSON,
|
|
||||||
Value: value,
|
|
||||||
Column: match.FieldEco,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
if muo.mutation.EcoCleared() {
|
|
||||||
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
|
||||||
Type: field.TypeJSON,
|
|
||||||
Column: match.FieldEco,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
if muo.mutation.StatsCleared() {
|
if muo.mutation.StatsCleared() {
|
||||||
edge := &sqlgraph.EdgeSpec{
|
edge := &sqlgraph.EdgeSpec{
|
||||||
Rel: sqlgraph.O2M,
|
Rel: sqlgraph.O2M,
|
||||||
|
@@ -21,7 +21,6 @@ var (
|
|||||||
{Name: "match_result", Type: field.TypeInt},
|
{Name: "match_result", Type: field.TypeInt},
|
||||||
{Name: "max_rounds", Type: field.TypeInt},
|
{Name: "max_rounds", Type: field.TypeInt},
|
||||||
{Name: "demo_parsed", Type: field.TypeBool, Default: false},
|
{Name: "demo_parsed", Type: field.TypeBool, Default: false},
|
||||||
{Name: "eco", Type: field.TypeJSON, Nullable: true},
|
|
||||||
}
|
}
|
||||||
// MatchesTable holds the schema information for the "matches" table.
|
// MatchesTable holds the schema information for the "matches" table.
|
||||||
MatchesTable = &schema.Table{
|
MatchesTable = &schema.Table{
|
||||||
|
125
ent/mutation.go
125
ent/mutation.go
@@ -54,23 +54,16 @@ type MatchMutation struct {
|
|||||||
max_rounds *int
|
max_rounds *int
|
||||||
addmax_rounds *int
|
addmax_rounds *int
|
||||||
demo_parsed *bool
|
demo_parsed *bool
|
||||||
eco *struct {
|
clearedFields map[string]struct{}
|
||||||
Rounds []*struct {
|
stats map[int]struct{}
|
||||||
Team int "json:\"team\""
|
removedstats map[int]struct{}
|
||||||
Bank int "json:\"bank\""
|
clearedstats bool
|
||||||
Equipment int "json:\"equipment\""
|
players map[uint64]struct{}
|
||||||
} "json:\"rounds\""
|
removedplayers map[uint64]struct{}
|
||||||
}
|
clearedplayers bool
|
||||||
clearedFields map[string]struct{}
|
done bool
|
||||||
stats map[int]struct{}
|
oldValue func(context.Context) (*Match, error)
|
||||||
removedstats map[int]struct{}
|
predicates []predicate.Match
|
||||||
clearedstats bool
|
|
||||||
players map[uint64]struct{}
|
|
||||||
removedplayers map[uint64]struct{}
|
|
||||||
clearedplayers bool
|
|
||||||
done bool
|
|
||||||
oldValue func(context.Context) (*Match, error)
|
|
||||||
predicates []predicate.Match
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ ent.Mutation = (*MatchMutation)(nil)
|
var _ ent.Mutation = (*MatchMutation)(nil)
|
||||||
@@ -644,73 +637,6 @@ func (m *MatchMutation) ResetDemoParsed() {
|
|||||||
m.demo_parsed = nil
|
m.demo_parsed = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetEco sets the "eco" field.
|
|
||||||
func (m *MatchMutation) SetEco(s struct {
|
|
||||||
Rounds []*struct {
|
|
||||||
Team int "json:\"team\""
|
|
||||||
Bank int "json:\"bank\""
|
|
||||||
Equipment int "json:\"equipment\""
|
|
||||||
} "json:\"rounds\""
|
|
||||||
}) {
|
|
||||||
m.eco = &s
|
|
||||||
}
|
|
||||||
|
|
||||||
// Eco returns the value of the "eco" field in the mutation.
|
|
||||||
func (m *MatchMutation) Eco() (r struct {
|
|
||||||
Rounds []*struct {
|
|
||||||
Team int "json:\"team\""
|
|
||||||
Bank int "json:\"bank\""
|
|
||||||
Equipment int "json:\"equipment\""
|
|
||||||
} "json:\"rounds\""
|
|
||||||
}, exists bool) {
|
|
||||||
v := m.eco
|
|
||||||
if v == nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
return *v, true
|
|
||||||
}
|
|
||||||
|
|
||||||
// OldEco returns the old "eco" 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) OldEco(ctx context.Context) (v struct {
|
|
||||||
Rounds []*struct {
|
|
||||||
Team int "json:\"team\""
|
|
||||||
Bank int "json:\"bank\""
|
|
||||||
Equipment int "json:\"equipment\""
|
|
||||||
} "json:\"rounds\""
|
|
||||||
}, err error) {
|
|
||||||
if !m.op.Is(OpUpdateOne) {
|
|
||||||
return v, fmt.Errorf("OldEco is only allowed on UpdateOne operations")
|
|
||||||
}
|
|
||||||
if m.id == nil || m.oldValue == nil {
|
|
||||||
return v, fmt.Errorf("OldEco requires an ID field in the mutation")
|
|
||||||
}
|
|
||||||
oldValue, err := m.oldValue(ctx)
|
|
||||||
if err != nil {
|
|
||||||
return v, fmt.Errorf("querying old value for OldEco: %w", err)
|
|
||||||
}
|
|
||||||
return oldValue.Eco, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// ClearEco clears the value of the "eco" field.
|
|
||||||
func (m *MatchMutation) ClearEco() {
|
|
||||||
m.eco = nil
|
|
||||||
m.clearedFields[match.FieldEco] = struct{}{}
|
|
||||||
}
|
|
||||||
|
|
||||||
// EcoCleared returns if the "eco" field was cleared in this mutation.
|
|
||||||
func (m *MatchMutation) EcoCleared() bool {
|
|
||||||
_, ok := m.clearedFields[match.FieldEco]
|
|
||||||
return ok
|
|
||||||
}
|
|
||||||
|
|
||||||
// ResetEco resets all changes to the "eco" field.
|
|
||||||
func (m *MatchMutation) ResetEco() {
|
|
||||||
m.eco = nil
|
|
||||||
delete(m.clearedFields, match.FieldEco)
|
|
||||||
}
|
|
||||||
|
|
||||||
// AddStatIDs adds the "stats" edge to the Stats entity by ids.
|
// AddStatIDs adds the "stats" edge to the Stats entity by ids.
|
||||||
func (m *MatchMutation) AddStatIDs(ids ...int) {
|
func (m *MatchMutation) AddStatIDs(ids ...int) {
|
||||||
if m.stats == nil {
|
if m.stats == nil {
|
||||||
@@ -838,7 +764,7 @@ func (m *MatchMutation) Type() string {
|
|||||||
// order to get all numeric fields that were incremented/decremented, call
|
// order to get all numeric fields that were incremented/decremented, call
|
||||||
// AddedFields().
|
// AddedFields().
|
||||||
func (m *MatchMutation) Fields() []string {
|
func (m *MatchMutation) Fields() []string {
|
||||||
fields := make([]string, 0, 11)
|
fields := make([]string, 0, 10)
|
||||||
if m.share_code != nil {
|
if m.share_code != nil {
|
||||||
fields = append(fields, match.FieldShareCode)
|
fields = append(fields, match.FieldShareCode)
|
||||||
}
|
}
|
||||||
@@ -869,9 +795,6 @@ func (m *MatchMutation) Fields() []string {
|
|||||||
if m.demo_parsed != nil {
|
if m.demo_parsed != nil {
|
||||||
fields = append(fields, match.FieldDemoParsed)
|
fields = append(fields, match.FieldDemoParsed)
|
||||||
}
|
}
|
||||||
if m.eco != nil {
|
|
||||||
fields = append(fields, match.FieldEco)
|
|
||||||
}
|
|
||||||
return fields
|
return fields
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -900,8 +823,6 @@ func (m *MatchMutation) Field(name string) (ent.Value, bool) {
|
|||||||
return m.MaxRounds()
|
return m.MaxRounds()
|
||||||
case match.FieldDemoParsed:
|
case match.FieldDemoParsed:
|
||||||
return m.DemoParsed()
|
return m.DemoParsed()
|
||||||
case match.FieldEco:
|
|
||||||
return m.Eco()
|
|
||||||
}
|
}
|
||||||
return nil, false
|
return nil, false
|
||||||
}
|
}
|
||||||
@@ -931,8 +852,6 @@ func (m *MatchMutation) OldField(ctx context.Context, name string) (ent.Value, e
|
|||||||
return m.OldMaxRounds(ctx)
|
return m.OldMaxRounds(ctx)
|
||||||
case match.FieldDemoParsed:
|
case match.FieldDemoParsed:
|
||||||
return m.OldDemoParsed(ctx)
|
return m.OldDemoParsed(ctx)
|
||||||
case match.FieldEco:
|
|
||||||
return m.OldEco(ctx)
|
|
||||||
}
|
}
|
||||||
return nil, fmt.Errorf("unknown Match field %s", name)
|
return nil, fmt.Errorf("unknown Match field %s", name)
|
||||||
}
|
}
|
||||||
@@ -1012,19 +931,6 @@ func (m *MatchMutation) SetField(name string, value ent.Value) error {
|
|||||||
}
|
}
|
||||||
m.SetDemoParsed(v)
|
m.SetDemoParsed(v)
|
||||||
return nil
|
return nil
|
||||||
case match.FieldEco:
|
|
||||||
v, ok := value.(struct {
|
|
||||||
Rounds []*struct {
|
|
||||||
Team int "json:\"team\""
|
|
||||||
Bank int "json:\"bank\""
|
|
||||||
Equipment int "json:\"equipment\""
|
|
||||||
} "json:\"rounds\""
|
|
||||||
})
|
|
||||||
if !ok {
|
|
||||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
||||||
}
|
|
||||||
m.SetEco(v)
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
return fmt.Errorf("unknown Match field %s", name)
|
return fmt.Errorf("unknown Match field %s", name)
|
||||||
}
|
}
|
||||||
@@ -1124,9 +1030,6 @@ func (m *MatchMutation) ClearedFields() []string {
|
|||||||
if m.FieldCleared(match.FieldReplayURL) {
|
if m.FieldCleared(match.FieldReplayURL) {
|
||||||
fields = append(fields, match.FieldReplayURL)
|
fields = append(fields, match.FieldReplayURL)
|
||||||
}
|
}
|
||||||
if m.FieldCleared(match.FieldEco) {
|
|
||||||
fields = append(fields, match.FieldEco)
|
|
||||||
}
|
|
||||||
return fields
|
return fields
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1147,9 +1050,6 @@ func (m *MatchMutation) ClearField(name string) error {
|
|||||||
case match.FieldReplayURL:
|
case match.FieldReplayURL:
|
||||||
m.ClearReplayURL()
|
m.ClearReplayURL()
|
||||||
return nil
|
return nil
|
||||||
case match.FieldEco:
|
|
||||||
m.ClearEco()
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
return fmt.Errorf("unknown Match nullable field %s", name)
|
return fmt.Errorf("unknown Match nullable field %s", name)
|
||||||
}
|
}
|
||||||
@@ -1188,9 +1088,6 @@ func (m *MatchMutation) ResetField(name string) error {
|
|||||||
case match.FieldDemoParsed:
|
case match.FieldDemoParsed:
|
||||||
m.ResetDemoParsed()
|
m.ResetDemoParsed()
|
||||||
return nil
|
return nil
|
||||||
case match.FieldEco:
|
|
||||||
m.ResetEco()
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
return fmt.Errorf("unknown Match field %s", name)
|
return fmt.Errorf("unknown Match field %s", name)
|
||||||
}
|
}
|
||||||
|
@@ -25,13 +25,6 @@ func (Match) Fields() []ent.Field {
|
|||||||
field.Int("match_result"),
|
field.Int("match_result"),
|
||||||
field.Int("max_rounds"),
|
field.Int("max_rounds"),
|
||||||
field.Bool("demo_parsed").Default(false),
|
field.Bool("demo_parsed").Default(false),
|
||||||
field.JSON("eco", struct {
|
|
||||||
Rounds []*struct {
|
|
||||||
Team int `json:"team"`
|
|
||||||
Bank int `json:"bank"`
|
|
||||||
Equipment int `json:"equipment"`
|
|
||||||
} `json:"rounds"`
|
|
||||||
}{}).Optional(),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user