added roundstats with eco info, switched to avatar hash
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"csgowtfd/ent/match"
|
||||
"csgowtfd/ent/player"
|
||||
"csgowtfd/ent/predicate"
|
||||
"csgowtfd/ent/roundstats"
|
||||
"csgowtfd/ent/stats"
|
||||
"csgowtfd/ent/weaponstats"
|
||||
"fmt"
|
||||
@@ -1009,6 +1010,21 @@ func (su *StatsUpdate) AddWeaponStats(w ...*WeaponStats) *StatsUpdate {
|
||||
return su.AddWeaponStatIDs(ids...)
|
||||
}
|
||||
|
||||
// AddRoundStatIDs adds the "round_stats" edge to the RoundStats entity by IDs.
|
||||
func (su *StatsUpdate) AddRoundStatIDs(ids ...int) *StatsUpdate {
|
||||
su.mutation.AddRoundStatIDs(ids...)
|
||||
return su
|
||||
}
|
||||
|
||||
// AddRoundStats adds the "round_stats" edges to the RoundStats entity.
|
||||
func (su *StatsUpdate) AddRoundStats(r ...*RoundStats) *StatsUpdate {
|
||||
ids := make([]int, len(r))
|
||||
for i := range r {
|
||||
ids[i] = r[i].ID
|
||||
}
|
||||
return su.AddRoundStatIDs(ids...)
|
||||
}
|
||||
|
||||
// Mutation returns the StatsMutation object of the builder.
|
||||
func (su *StatsUpdate) Mutation() *StatsMutation {
|
||||
return su.mutation
|
||||
@@ -1047,6 +1063,27 @@ func (su *StatsUpdate) RemoveWeaponStats(w ...*WeaponStats) *StatsUpdate {
|
||||
return su.RemoveWeaponStatIDs(ids...)
|
||||
}
|
||||
|
||||
// ClearRoundStats clears all "round_stats" edges to the RoundStats entity.
|
||||
func (su *StatsUpdate) ClearRoundStats() *StatsUpdate {
|
||||
su.mutation.ClearRoundStats()
|
||||
return su
|
||||
}
|
||||
|
||||
// RemoveRoundStatIDs removes the "round_stats" edge to RoundStats entities by IDs.
|
||||
func (su *StatsUpdate) RemoveRoundStatIDs(ids ...int) *StatsUpdate {
|
||||
su.mutation.RemoveRoundStatIDs(ids...)
|
||||
return su
|
||||
}
|
||||
|
||||
// RemoveRoundStats removes "round_stats" edges to RoundStats entities.
|
||||
func (su *StatsUpdate) RemoveRoundStats(r ...*RoundStats) *StatsUpdate {
|
||||
ids := make([]int, len(r))
|
||||
for i := range r {
|
||||
ids[i] = r[i].ID
|
||||
}
|
||||
return su.RemoveRoundStatIDs(ids...)
|
||||
}
|
||||
|
||||
// Save executes the query and returns the number of nodes affected by the update operation.
|
||||
func (su *StatsUpdate) Save(ctx context.Context) (int, error) {
|
||||
var (
|
||||
@@ -1943,6 +1980,60 @@ func (su *StatsUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
}
|
||||
_spec.Edges.Add = append(_spec.Edges.Add, edge)
|
||||
}
|
||||
if su.mutation.RoundStatsCleared() {
|
||||
edge := &sqlgraph.EdgeSpec{
|
||||
Rel: sqlgraph.O2M,
|
||||
Inverse: false,
|
||||
Table: stats.RoundStatsTable,
|
||||
Columns: []string{stats.RoundStatsColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: roundstats.FieldID,
|
||||
},
|
||||
},
|
||||
}
|
||||
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
||||
}
|
||||
if nodes := su.mutation.RemovedRoundStatsIDs(); len(nodes) > 0 && !su.mutation.RoundStatsCleared() {
|
||||
edge := &sqlgraph.EdgeSpec{
|
||||
Rel: sqlgraph.O2M,
|
||||
Inverse: false,
|
||||
Table: stats.RoundStatsTable,
|
||||
Columns: []string{stats.RoundStatsColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: roundstats.FieldID,
|
||||
},
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
edge.Target.Nodes = append(edge.Target.Nodes, k)
|
||||
}
|
||||
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
||||
}
|
||||
if nodes := su.mutation.RoundStatsIDs(); len(nodes) > 0 {
|
||||
edge := &sqlgraph.EdgeSpec{
|
||||
Rel: sqlgraph.O2M,
|
||||
Inverse: false,
|
||||
Table: stats.RoundStatsTable,
|
||||
Columns: []string{stats.RoundStatsColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: roundstats.FieldID,
|
||||
},
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
edge.Target.Nodes = append(edge.Target.Nodes, k)
|
||||
}
|
||||
_spec.Edges.Add = append(_spec.Edges.Add, edge)
|
||||
}
|
||||
if n, err = sqlgraph.UpdateNodes(ctx, su.driver, _spec); err != nil {
|
||||
if _, ok := err.(*sqlgraph.NotFoundError); ok {
|
||||
err = &NotFoundError{stats.Label}
|
||||
@@ -2942,6 +3033,21 @@ func (suo *StatsUpdateOne) AddWeaponStats(w ...*WeaponStats) *StatsUpdateOne {
|
||||
return suo.AddWeaponStatIDs(ids...)
|
||||
}
|
||||
|
||||
// AddRoundStatIDs adds the "round_stats" edge to the RoundStats entity by IDs.
|
||||
func (suo *StatsUpdateOne) AddRoundStatIDs(ids ...int) *StatsUpdateOne {
|
||||
suo.mutation.AddRoundStatIDs(ids...)
|
||||
return suo
|
||||
}
|
||||
|
||||
// AddRoundStats adds the "round_stats" edges to the RoundStats entity.
|
||||
func (suo *StatsUpdateOne) AddRoundStats(r ...*RoundStats) *StatsUpdateOne {
|
||||
ids := make([]int, len(r))
|
||||
for i := range r {
|
||||
ids[i] = r[i].ID
|
||||
}
|
||||
return suo.AddRoundStatIDs(ids...)
|
||||
}
|
||||
|
||||
// Mutation returns the StatsMutation object of the builder.
|
||||
func (suo *StatsUpdateOne) Mutation() *StatsMutation {
|
||||
return suo.mutation
|
||||
@@ -2980,6 +3086,27 @@ func (suo *StatsUpdateOne) RemoveWeaponStats(w ...*WeaponStats) *StatsUpdateOne
|
||||
return suo.RemoveWeaponStatIDs(ids...)
|
||||
}
|
||||
|
||||
// ClearRoundStats clears all "round_stats" edges to the RoundStats entity.
|
||||
func (suo *StatsUpdateOne) ClearRoundStats() *StatsUpdateOne {
|
||||
suo.mutation.ClearRoundStats()
|
||||
return suo
|
||||
}
|
||||
|
||||
// RemoveRoundStatIDs removes the "round_stats" edge to RoundStats entities by IDs.
|
||||
func (suo *StatsUpdateOne) RemoveRoundStatIDs(ids ...int) *StatsUpdateOne {
|
||||
suo.mutation.RemoveRoundStatIDs(ids...)
|
||||
return suo
|
||||
}
|
||||
|
||||
// RemoveRoundStats removes "round_stats" edges to RoundStats entities.
|
||||
func (suo *StatsUpdateOne) RemoveRoundStats(r ...*RoundStats) *StatsUpdateOne {
|
||||
ids := make([]int, len(r))
|
||||
for i := range r {
|
||||
ids[i] = r[i].ID
|
||||
}
|
||||
return suo.RemoveRoundStatIDs(ids...)
|
||||
}
|
||||
|
||||
// Select allows selecting one or more fields (columns) of the returned entity.
|
||||
// The default is selecting all fields defined in the entity schema.
|
||||
func (suo *StatsUpdateOne) Select(field string, fields ...string) *StatsUpdateOne {
|
||||
@@ -3900,6 +4027,60 @@ func (suo *StatsUpdateOne) sqlSave(ctx context.Context) (_node *Stats, err error
|
||||
}
|
||||
_spec.Edges.Add = append(_spec.Edges.Add, edge)
|
||||
}
|
||||
if suo.mutation.RoundStatsCleared() {
|
||||
edge := &sqlgraph.EdgeSpec{
|
||||
Rel: sqlgraph.O2M,
|
||||
Inverse: false,
|
||||
Table: stats.RoundStatsTable,
|
||||
Columns: []string{stats.RoundStatsColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: roundstats.FieldID,
|
||||
},
|
||||
},
|
||||
}
|
||||
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
||||
}
|
||||
if nodes := suo.mutation.RemovedRoundStatsIDs(); len(nodes) > 0 && !suo.mutation.RoundStatsCleared() {
|
||||
edge := &sqlgraph.EdgeSpec{
|
||||
Rel: sqlgraph.O2M,
|
||||
Inverse: false,
|
||||
Table: stats.RoundStatsTable,
|
||||
Columns: []string{stats.RoundStatsColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: roundstats.FieldID,
|
||||
},
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
edge.Target.Nodes = append(edge.Target.Nodes, k)
|
||||
}
|
||||
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
||||
}
|
||||
if nodes := suo.mutation.RoundStatsIDs(); len(nodes) > 0 {
|
||||
edge := &sqlgraph.EdgeSpec{
|
||||
Rel: sqlgraph.O2M,
|
||||
Inverse: false,
|
||||
Table: stats.RoundStatsTable,
|
||||
Columns: []string{stats.RoundStatsColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: roundstats.FieldID,
|
||||
},
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
edge.Target.Nodes = append(edge.Target.Nodes, k)
|
||||
}
|
||||
_spec.Edges.Add = append(_spec.Edges.Add, edge)
|
||||
}
|
||||
_node = &Stats{config: suo.config}
|
||||
_spec.Assign = _node.assignValues
|
||||
_spec.ScanValues = _node.scanValues
|
||||
|
Reference in New Issue
Block a user