added chat messages
This commit is contained in:
@@ -6,11 +6,13 @@ import (
|
||||
"context"
|
||||
"csgowtfd/ent/match"
|
||||
"csgowtfd/ent/matchplayer"
|
||||
"csgowtfd/ent/messages"
|
||||
"csgowtfd/ent/player"
|
||||
"csgowtfd/ent/predicate"
|
||||
"csgowtfd/ent/roundstats"
|
||||
"csgowtfd/ent/spray"
|
||||
"csgowtfd/ent/weapon"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
@@ -104,7 +106,7 @@ func (mpu *MatchPlayerUpdate) SetMvp(u uint) *MatchPlayerUpdate {
|
||||
}
|
||||
|
||||
// AddMvp adds u to the "mvp" field.
|
||||
func (mpu *MatchPlayerUpdate) AddMvp(u uint) *MatchPlayerUpdate {
|
||||
func (mpu *MatchPlayerUpdate) AddMvp(u int) *MatchPlayerUpdate {
|
||||
mpu.mutation.AddMvp(u)
|
||||
return mpu
|
||||
}
|
||||
@@ -192,7 +194,7 @@ func (mpu *MatchPlayerUpdate) SetNillableMk2(u *uint) *MatchPlayerUpdate {
|
||||
}
|
||||
|
||||
// AddMk2 adds u to the "mk_2" field.
|
||||
func (mpu *MatchPlayerUpdate) AddMk2(u uint) *MatchPlayerUpdate {
|
||||
func (mpu *MatchPlayerUpdate) AddMk2(u int) *MatchPlayerUpdate {
|
||||
mpu.mutation.AddMk2(u)
|
||||
return mpu
|
||||
}
|
||||
@@ -219,7 +221,7 @@ func (mpu *MatchPlayerUpdate) SetNillableMk3(u *uint) *MatchPlayerUpdate {
|
||||
}
|
||||
|
||||
// AddMk3 adds u to the "mk_3" field.
|
||||
func (mpu *MatchPlayerUpdate) AddMk3(u uint) *MatchPlayerUpdate {
|
||||
func (mpu *MatchPlayerUpdate) AddMk3(u int) *MatchPlayerUpdate {
|
||||
mpu.mutation.AddMk3(u)
|
||||
return mpu
|
||||
}
|
||||
@@ -246,7 +248,7 @@ func (mpu *MatchPlayerUpdate) SetNillableMk4(u *uint) *MatchPlayerUpdate {
|
||||
}
|
||||
|
||||
// AddMk4 adds u to the "mk_4" field.
|
||||
func (mpu *MatchPlayerUpdate) AddMk4(u uint) *MatchPlayerUpdate {
|
||||
func (mpu *MatchPlayerUpdate) AddMk4(u int) *MatchPlayerUpdate {
|
||||
mpu.mutation.AddMk4(u)
|
||||
return mpu
|
||||
}
|
||||
@@ -273,7 +275,7 @@ func (mpu *MatchPlayerUpdate) SetNillableMk5(u *uint) *MatchPlayerUpdate {
|
||||
}
|
||||
|
||||
// AddMk5 adds u to the "mk_5" field.
|
||||
func (mpu *MatchPlayerUpdate) AddMk5(u uint) *MatchPlayerUpdate {
|
||||
func (mpu *MatchPlayerUpdate) AddMk5(u int) *MatchPlayerUpdate {
|
||||
mpu.mutation.AddMk5(u)
|
||||
return mpu
|
||||
}
|
||||
@@ -300,7 +302,7 @@ func (mpu *MatchPlayerUpdate) SetNillableDmgEnemy(u *uint) *MatchPlayerUpdate {
|
||||
}
|
||||
|
||||
// AddDmgEnemy adds u to the "dmg_enemy" field.
|
||||
func (mpu *MatchPlayerUpdate) AddDmgEnemy(u uint) *MatchPlayerUpdate {
|
||||
func (mpu *MatchPlayerUpdate) AddDmgEnemy(u int) *MatchPlayerUpdate {
|
||||
mpu.mutation.AddDmgEnemy(u)
|
||||
return mpu
|
||||
}
|
||||
@@ -327,7 +329,7 @@ func (mpu *MatchPlayerUpdate) SetNillableDmgTeam(u *uint) *MatchPlayerUpdate {
|
||||
}
|
||||
|
||||
// AddDmgTeam adds u to the "dmg_team" field.
|
||||
func (mpu *MatchPlayerUpdate) AddDmgTeam(u uint) *MatchPlayerUpdate {
|
||||
func (mpu *MatchPlayerUpdate) AddDmgTeam(u int) *MatchPlayerUpdate {
|
||||
mpu.mutation.AddDmgTeam(u)
|
||||
return mpu
|
||||
}
|
||||
@@ -354,7 +356,7 @@ func (mpu *MatchPlayerUpdate) SetNillableUdHe(u *uint) *MatchPlayerUpdate {
|
||||
}
|
||||
|
||||
// AddUdHe adds u to the "ud_he" field.
|
||||
func (mpu *MatchPlayerUpdate) AddUdHe(u uint) *MatchPlayerUpdate {
|
||||
func (mpu *MatchPlayerUpdate) AddUdHe(u int) *MatchPlayerUpdate {
|
||||
mpu.mutation.AddUdHe(u)
|
||||
return mpu
|
||||
}
|
||||
@@ -381,7 +383,7 @@ func (mpu *MatchPlayerUpdate) SetNillableUdFlames(u *uint) *MatchPlayerUpdate {
|
||||
}
|
||||
|
||||
// AddUdFlames adds u to the "ud_flames" field.
|
||||
func (mpu *MatchPlayerUpdate) AddUdFlames(u uint) *MatchPlayerUpdate {
|
||||
func (mpu *MatchPlayerUpdate) AddUdFlames(u int) *MatchPlayerUpdate {
|
||||
mpu.mutation.AddUdFlames(u)
|
||||
return mpu
|
||||
}
|
||||
@@ -408,7 +410,7 @@ func (mpu *MatchPlayerUpdate) SetNillableUdFlash(u *uint) *MatchPlayerUpdate {
|
||||
}
|
||||
|
||||
// AddUdFlash adds u to the "ud_flash" field.
|
||||
func (mpu *MatchPlayerUpdate) AddUdFlash(u uint) *MatchPlayerUpdate {
|
||||
func (mpu *MatchPlayerUpdate) AddUdFlash(u int) *MatchPlayerUpdate {
|
||||
mpu.mutation.AddUdFlash(u)
|
||||
return mpu
|
||||
}
|
||||
@@ -435,7 +437,7 @@ func (mpu *MatchPlayerUpdate) SetNillableUdDecoy(u *uint) *MatchPlayerUpdate {
|
||||
}
|
||||
|
||||
// AddUdDecoy adds u to the "ud_decoy" field.
|
||||
func (mpu *MatchPlayerUpdate) AddUdDecoy(u uint) *MatchPlayerUpdate {
|
||||
func (mpu *MatchPlayerUpdate) AddUdDecoy(u int) *MatchPlayerUpdate {
|
||||
mpu.mutation.AddUdDecoy(u)
|
||||
return mpu
|
||||
}
|
||||
@@ -462,7 +464,7 @@ func (mpu *MatchPlayerUpdate) SetNillableUdSmoke(u *uint) *MatchPlayerUpdate {
|
||||
}
|
||||
|
||||
// AddUdSmoke adds u to the "ud_smoke" field.
|
||||
func (mpu *MatchPlayerUpdate) AddUdSmoke(u uint) *MatchPlayerUpdate {
|
||||
func (mpu *MatchPlayerUpdate) AddUdSmoke(u int) *MatchPlayerUpdate {
|
||||
mpu.mutation.AddUdSmoke(u)
|
||||
return mpu
|
||||
}
|
||||
@@ -637,7 +639,7 @@ func (mpu *MatchPlayerUpdate) SetNillableFlashTotalSelf(u *uint) *MatchPlayerUpd
|
||||
}
|
||||
|
||||
// AddFlashTotalSelf adds u to the "flash_total_self" field.
|
||||
func (mpu *MatchPlayerUpdate) AddFlashTotalSelf(u uint) *MatchPlayerUpdate {
|
||||
func (mpu *MatchPlayerUpdate) AddFlashTotalSelf(u int) *MatchPlayerUpdate {
|
||||
mpu.mutation.AddFlashTotalSelf(u)
|
||||
return mpu
|
||||
}
|
||||
@@ -664,7 +666,7 @@ func (mpu *MatchPlayerUpdate) SetNillableFlashTotalTeam(u *uint) *MatchPlayerUpd
|
||||
}
|
||||
|
||||
// AddFlashTotalTeam adds u to the "flash_total_team" field.
|
||||
func (mpu *MatchPlayerUpdate) AddFlashTotalTeam(u uint) *MatchPlayerUpdate {
|
||||
func (mpu *MatchPlayerUpdate) AddFlashTotalTeam(u int) *MatchPlayerUpdate {
|
||||
mpu.mutation.AddFlashTotalTeam(u)
|
||||
return mpu
|
||||
}
|
||||
@@ -691,7 +693,7 @@ func (mpu *MatchPlayerUpdate) SetNillableFlashTotalEnemy(u *uint) *MatchPlayerUp
|
||||
}
|
||||
|
||||
// AddFlashTotalEnemy adds u to the "flash_total_enemy" field.
|
||||
func (mpu *MatchPlayerUpdate) AddFlashTotalEnemy(u uint) *MatchPlayerUpdate {
|
||||
func (mpu *MatchPlayerUpdate) AddFlashTotalEnemy(u int) *MatchPlayerUpdate {
|
||||
mpu.mutation.AddFlashTotalEnemy(u)
|
||||
return mpu
|
||||
}
|
||||
@@ -852,6 +854,21 @@ func (mpu *MatchPlayerUpdate) AddSpray(s ...*Spray) *MatchPlayerUpdate {
|
||||
return mpu.AddSprayIDs(ids...)
|
||||
}
|
||||
|
||||
// AddMessageIDs adds the "messages" edge to the Messages entity by IDs.
|
||||
func (mpu *MatchPlayerUpdate) AddMessageIDs(ids ...int) *MatchPlayerUpdate {
|
||||
mpu.mutation.AddMessageIDs(ids...)
|
||||
return mpu
|
||||
}
|
||||
|
||||
// AddMessages adds the "messages" edges to the Messages entity.
|
||||
func (mpu *MatchPlayerUpdate) AddMessages(m ...*Messages) *MatchPlayerUpdate {
|
||||
ids := make([]int, len(m))
|
||||
for i := range m {
|
||||
ids[i] = m[i].ID
|
||||
}
|
||||
return mpu.AddMessageIDs(ids...)
|
||||
}
|
||||
|
||||
// Mutation returns the MatchPlayerMutation object of the builder.
|
||||
func (mpu *MatchPlayerUpdate) Mutation() *MatchPlayerMutation {
|
||||
return mpu.mutation
|
||||
@@ -932,6 +949,27 @@ func (mpu *MatchPlayerUpdate) RemoveSpray(s ...*Spray) *MatchPlayerUpdate {
|
||||
return mpu.RemoveSprayIDs(ids...)
|
||||
}
|
||||
|
||||
// ClearMessages clears all "messages" edges to the Messages entity.
|
||||
func (mpu *MatchPlayerUpdate) ClearMessages() *MatchPlayerUpdate {
|
||||
mpu.mutation.ClearMessages()
|
||||
return mpu
|
||||
}
|
||||
|
||||
// RemoveMessageIDs removes the "messages" edge to Messages entities by IDs.
|
||||
func (mpu *MatchPlayerUpdate) RemoveMessageIDs(ids ...int) *MatchPlayerUpdate {
|
||||
mpu.mutation.RemoveMessageIDs(ids...)
|
||||
return mpu
|
||||
}
|
||||
|
||||
// RemoveMessages removes "messages" edges to Messages entities.
|
||||
func (mpu *MatchPlayerUpdate) RemoveMessages(m ...*Messages) *MatchPlayerUpdate {
|
||||
ids := make([]int, len(m))
|
||||
for i := range m {
|
||||
ids[i] = m[i].ID
|
||||
}
|
||||
return mpu.RemoveMessageIDs(ids...)
|
||||
}
|
||||
|
||||
// Save executes the query and returns the number of nodes affected by the update operation.
|
||||
func (mpu *MatchPlayerUpdate) Save(ctx context.Context) (int, error) {
|
||||
var (
|
||||
@@ -996,7 +1034,7 @@ func (mpu *MatchPlayerUpdate) ExecX(ctx context.Context) {
|
||||
func (mpu *MatchPlayerUpdate) check() error {
|
||||
if v, ok := mpu.mutation.Color(); ok {
|
||||
if err := matchplayer.ColorValidator(v); err != nil {
|
||||
return &ValidationError{Name: "color", err: fmt.Errorf("ent: validator failed for field \"color\": %w", err)}
|
||||
return &ValidationError{Name: "color", err: fmt.Errorf(`ent: validator failed for field "MatchPlayer.color": %w`, err)}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
@@ -1796,6 +1834,60 @@ func (mpu *MatchPlayerUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
}
|
||||
_spec.Edges.Add = append(_spec.Edges.Add, edge)
|
||||
}
|
||||
if mpu.mutation.MessagesCleared() {
|
||||
edge := &sqlgraph.EdgeSpec{
|
||||
Rel: sqlgraph.O2M,
|
||||
Inverse: false,
|
||||
Table: matchplayer.MessagesTable,
|
||||
Columns: []string{matchplayer.MessagesColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: messages.FieldID,
|
||||
},
|
||||
},
|
||||
}
|
||||
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
||||
}
|
||||
if nodes := mpu.mutation.RemovedMessagesIDs(); len(nodes) > 0 && !mpu.mutation.MessagesCleared() {
|
||||
edge := &sqlgraph.EdgeSpec{
|
||||
Rel: sqlgraph.O2M,
|
||||
Inverse: false,
|
||||
Table: matchplayer.MessagesTable,
|
||||
Columns: []string{matchplayer.MessagesColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: messages.FieldID,
|
||||
},
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
edge.Target.Nodes = append(edge.Target.Nodes, k)
|
||||
}
|
||||
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
||||
}
|
||||
if nodes := mpu.mutation.MessagesIDs(); len(nodes) > 0 {
|
||||
edge := &sqlgraph.EdgeSpec{
|
||||
Rel: sqlgraph.O2M,
|
||||
Inverse: false,
|
||||
Table: matchplayer.MessagesTable,
|
||||
Columns: []string{matchplayer.MessagesColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: messages.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, mpu.driver, _spec); err != nil {
|
||||
if _, ok := err.(*sqlgraph.NotFoundError); ok {
|
||||
err = &NotFoundError{matchplayer.Label}
|
||||
@@ -1888,7 +1980,7 @@ func (mpuo *MatchPlayerUpdateOne) SetMvp(u uint) *MatchPlayerUpdateOne {
|
||||
}
|
||||
|
||||
// AddMvp adds u to the "mvp" field.
|
||||
func (mpuo *MatchPlayerUpdateOne) AddMvp(u uint) *MatchPlayerUpdateOne {
|
||||
func (mpuo *MatchPlayerUpdateOne) AddMvp(u int) *MatchPlayerUpdateOne {
|
||||
mpuo.mutation.AddMvp(u)
|
||||
return mpuo
|
||||
}
|
||||
@@ -1976,7 +2068,7 @@ func (mpuo *MatchPlayerUpdateOne) SetNillableMk2(u *uint) *MatchPlayerUpdateOne
|
||||
}
|
||||
|
||||
// AddMk2 adds u to the "mk_2" field.
|
||||
func (mpuo *MatchPlayerUpdateOne) AddMk2(u uint) *MatchPlayerUpdateOne {
|
||||
func (mpuo *MatchPlayerUpdateOne) AddMk2(u int) *MatchPlayerUpdateOne {
|
||||
mpuo.mutation.AddMk2(u)
|
||||
return mpuo
|
||||
}
|
||||
@@ -2003,7 +2095,7 @@ func (mpuo *MatchPlayerUpdateOne) SetNillableMk3(u *uint) *MatchPlayerUpdateOne
|
||||
}
|
||||
|
||||
// AddMk3 adds u to the "mk_3" field.
|
||||
func (mpuo *MatchPlayerUpdateOne) AddMk3(u uint) *MatchPlayerUpdateOne {
|
||||
func (mpuo *MatchPlayerUpdateOne) AddMk3(u int) *MatchPlayerUpdateOne {
|
||||
mpuo.mutation.AddMk3(u)
|
||||
return mpuo
|
||||
}
|
||||
@@ -2030,7 +2122,7 @@ func (mpuo *MatchPlayerUpdateOne) SetNillableMk4(u *uint) *MatchPlayerUpdateOne
|
||||
}
|
||||
|
||||
// AddMk4 adds u to the "mk_4" field.
|
||||
func (mpuo *MatchPlayerUpdateOne) AddMk4(u uint) *MatchPlayerUpdateOne {
|
||||
func (mpuo *MatchPlayerUpdateOne) AddMk4(u int) *MatchPlayerUpdateOne {
|
||||
mpuo.mutation.AddMk4(u)
|
||||
return mpuo
|
||||
}
|
||||
@@ -2057,7 +2149,7 @@ func (mpuo *MatchPlayerUpdateOne) SetNillableMk5(u *uint) *MatchPlayerUpdateOne
|
||||
}
|
||||
|
||||
// AddMk5 adds u to the "mk_5" field.
|
||||
func (mpuo *MatchPlayerUpdateOne) AddMk5(u uint) *MatchPlayerUpdateOne {
|
||||
func (mpuo *MatchPlayerUpdateOne) AddMk5(u int) *MatchPlayerUpdateOne {
|
||||
mpuo.mutation.AddMk5(u)
|
||||
return mpuo
|
||||
}
|
||||
@@ -2084,7 +2176,7 @@ func (mpuo *MatchPlayerUpdateOne) SetNillableDmgEnemy(u *uint) *MatchPlayerUpdat
|
||||
}
|
||||
|
||||
// AddDmgEnemy adds u to the "dmg_enemy" field.
|
||||
func (mpuo *MatchPlayerUpdateOne) AddDmgEnemy(u uint) *MatchPlayerUpdateOne {
|
||||
func (mpuo *MatchPlayerUpdateOne) AddDmgEnemy(u int) *MatchPlayerUpdateOne {
|
||||
mpuo.mutation.AddDmgEnemy(u)
|
||||
return mpuo
|
||||
}
|
||||
@@ -2111,7 +2203,7 @@ func (mpuo *MatchPlayerUpdateOne) SetNillableDmgTeam(u *uint) *MatchPlayerUpdate
|
||||
}
|
||||
|
||||
// AddDmgTeam adds u to the "dmg_team" field.
|
||||
func (mpuo *MatchPlayerUpdateOne) AddDmgTeam(u uint) *MatchPlayerUpdateOne {
|
||||
func (mpuo *MatchPlayerUpdateOne) AddDmgTeam(u int) *MatchPlayerUpdateOne {
|
||||
mpuo.mutation.AddDmgTeam(u)
|
||||
return mpuo
|
||||
}
|
||||
@@ -2138,7 +2230,7 @@ func (mpuo *MatchPlayerUpdateOne) SetNillableUdHe(u *uint) *MatchPlayerUpdateOne
|
||||
}
|
||||
|
||||
// AddUdHe adds u to the "ud_he" field.
|
||||
func (mpuo *MatchPlayerUpdateOne) AddUdHe(u uint) *MatchPlayerUpdateOne {
|
||||
func (mpuo *MatchPlayerUpdateOne) AddUdHe(u int) *MatchPlayerUpdateOne {
|
||||
mpuo.mutation.AddUdHe(u)
|
||||
return mpuo
|
||||
}
|
||||
@@ -2165,7 +2257,7 @@ func (mpuo *MatchPlayerUpdateOne) SetNillableUdFlames(u *uint) *MatchPlayerUpdat
|
||||
}
|
||||
|
||||
// AddUdFlames adds u to the "ud_flames" field.
|
||||
func (mpuo *MatchPlayerUpdateOne) AddUdFlames(u uint) *MatchPlayerUpdateOne {
|
||||
func (mpuo *MatchPlayerUpdateOne) AddUdFlames(u int) *MatchPlayerUpdateOne {
|
||||
mpuo.mutation.AddUdFlames(u)
|
||||
return mpuo
|
||||
}
|
||||
@@ -2192,7 +2284,7 @@ func (mpuo *MatchPlayerUpdateOne) SetNillableUdFlash(u *uint) *MatchPlayerUpdate
|
||||
}
|
||||
|
||||
// AddUdFlash adds u to the "ud_flash" field.
|
||||
func (mpuo *MatchPlayerUpdateOne) AddUdFlash(u uint) *MatchPlayerUpdateOne {
|
||||
func (mpuo *MatchPlayerUpdateOne) AddUdFlash(u int) *MatchPlayerUpdateOne {
|
||||
mpuo.mutation.AddUdFlash(u)
|
||||
return mpuo
|
||||
}
|
||||
@@ -2219,7 +2311,7 @@ func (mpuo *MatchPlayerUpdateOne) SetNillableUdDecoy(u *uint) *MatchPlayerUpdate
|
||||
}
|
||||
|
||||
// AddUdDecoy adds u to the "ud_decoy" field.
|
||||
func (mpuo *MatchPlayerUpdateOne) AddUdDecoy(u uint) *MatchPlayerUpdateOne {
|
||||
func (mpuo *MatchPlayerUpdateOne) AddUdDecoy(u int) *MatchPlayerUpdateOne {
|
||||
mpuo.mutation.AddUdDecoy(u)
|
||||
return mpuo
|
||||
}
|
||||
@@ -2246,7 +2338,7 @@ func (mpuo *MatchPlayerUpdateOne) SetNillableUdSmoke(u *uint) *MatchPlayerUpdate
|
||||
}
|
||||
|
||||
// AddUdSmoke adds u to the "ud_smoke" field.
|
||||
func (mpuo *MatchPlayerUpdateOne) AddUdSmoke(u uint) *MatchPlayerUpdateOne {
|
||||
func (mpuo *MatchPlayerUpdateOne) AddUdSmoke(u int) *MatchPlayerUpdateOne {
|
||||
mpuo.mutation.AddUdSmoke(u)
|
||||
return mpuo
|
||||
}
|
||||
@@ -2421,7 +2513,7 @@ func (mpuo *MatchPlayerUpdateOne) SetNillableFlashTotalSelf(u *uint) *MatchPlaye
|
||||
}
|
||||
|
||||
// AddFlashTotalSelf adds u to the "flash_total_self" field.
|
||||
func (mpuo *MatchPlayerUpdateOne) AddFlashTotalSelf(u uint) *MatchPlayerUpdateOne {
|
||||
func (mpuo *MatchPlayerUpdateOne) AddFlashTotalSelf(u int) *MatchPlayerUpdateOne {
|
||||
mpuo.mutation.AddFlashTotalSelf(u)
|
||||
return mpuo
|
||||
}
|
||||
@@ -2448,7 +2540,7 @@ func (mpuo *MatchPlayerUpdateOne) SetNillableFlashTotalTeam(u *uint) *MatchPlaye
|
||||
}
|
||||
|
||||
// AddFlashTotalTeam adds u to the "flash_total_team" field.
|
||||
func (mpuo *MatchPlayerUpdateOne) AddFlashTotalTeam(u uint) *MatchPlayerUpdateOne {
|
||||
func (mpuo *MatchPlayerUpdateOne) AddFlashTotalTeam(u int) *MatchPlayerUpdateOne {
|
||||
mpuo.mutation.AddFlashTotalTeam(u)
|
||||
return mpuo
|
||||
}
|
||||
@@ -2475,7 +2567,7 @@ func (mpuo *MatchPlayerUpdateOne) SetNillableFlashTotalEnemy(u *uint) *MatchPlay
|
||||
}
|
||||
|
||||
// AddFlashTotalEnemy adds u to the "flash_total_enemy" field.
|
||||
func (mpuo *MatchPlayerUpdateOne) AddFlashTotalEnemy(u uint) *MatchPlayerUpdateOne {
|
||||
func (mpuo *MatchPlayerUpdateOne) AddFlashTotalEnemy(u int) *MatchPlayerUpdateOne {
|
||||
mpuo.mutation.AddFlashTotalEnemy(u)
|
||||
return mpuo
|
||||
}
|
||||
@@ -2636,6 +2728,21 @@ func (mpuo *MatchPlayerUpdateOne) AddSpray(s ...*Spray) *MatchPlayerUpdateOne {
|
||||
return mpuo.AddSprayIDs(ids...)
|
||||
}
|
||||
|
||||
// AddMessageIDs adds the "messages" edge to the Messages entity by IDs.
|
||||
func (mpuo *MatchPlayerUpdateOne) AddMessageIDs(ids ...int) *MatchPlayerUpdateOne {
|
||||
mpuo.mutation.AddMessageIDs(ids...)
|
||||
return mpuo
|
||||
}
|
||||
|
||||
// AddMessages adds the "messages" edges to the Messages entity.
|
||||
func (mpuo *MatchPlayerUpdateOne) AddMessages(m ...*Messages) *MatchPlayerUpdateOne {
|
||||
ids := make([]int, len(m))
|
||||
for i := range m {
|
||||
ids[i] = m[i].ID
|
||||
}
|
||||
return mpuo.AddMessageIDs(ids...)
|
||||
}
|
||||
|
||||
// Mutation returns the MatchPlayerMutation object of the builder.
|
||||
func (mpuo *MatchPlayerUpdateOne) Mutation() *MatchPlayerMutation {
|
||||
return mpuo.mutation
|
||||
@@ -2716,6 +2823,27 @@ func (mpuo *MatchPlayerUpdateOne) RemoveSpray(s ...*Spray) *MatchPlayerUpdateOne
|
||||
return mpuo.RemoveSprayIDs(ids...)
|
||||
}
|
||||
|
||||
// ClearMessages clears all "messages" edges to the Messages entity.
|
||||
func (mpuo *MatchPlayerUpdateOne) ClearMessages() *MatchPlayerUpdateOne {
|
||||
mpuo.mutation.ClearMessages()
|
||||
return mpuo
|
||||
}
|
||||
|
||||
// RemoveMessageIDs removes the "messages" edge to Messages entities by IDs.
|
||||
func (mpuo *MatchPlayerUpdateOne) RemoveMessageIDs(ids ...int) *MatchPlayerUpdateOne {
|
||||
mpuo.mutation.RemoveMessageIDs(ids...)
|
||||
return mpuo
|
||||
}
|
||||
|
||||
// RemoveMessages removes "messages" edges to Messages entities.
|
||||
func (mpuo *MatchPlayerUpdateOne) RemoveMessages(m ...*Messages) *MatchPlayerUpdateOne {
|
||||
ids := make([]int, len(m))
|
||||
for i := range m {
|
||||
ids[i] = m[i].ID
|
||||
}
|
||||
return mpuo.RemoveMessageIDs(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 (mpuo *MatchPlayerUpdateOne) Select(field string, fields ...string) *MatchPlayerUpdateOne {
|
||||
@@ -2787,7 +2915,7 @@ func (mpuo *MatchPlayerUpdateOne) ExecX(ctx context.Context) {
|
||||
func (mpuo *MatchPlayerUpdateOne) check() error {
|
||||
if v, ok := mpuo.mutation.Color(); ok {
|
||||
if err := matchplayer.ColorValidator(v); err != nil {
|
||||
return &ValidationError{Name: "color", err: fmt.Errorf("ent: validator failed for field \"color\": %w", err)}
|
||||
return &ValidationError{Name: "color", err: fmt.Errorf(`ent: validator failed for field "MatchPlayer.color": %w`, err)}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
@@ -2806,7 +2934,7 @@ func (mpuo *MatchPlayerUpdateOne) sqlSave(ctx context.Context) (_node *MatchPlay
|
||||
}
|
||||
id, ok := mpuo.mutation.ID()
|
||||
if !ok {
|
||||
return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing MatchPlayer.ID for update")}
|
||||
return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "MatchPlayer.id" for update`)}
|
||||
}
|
||||
_spec.Node.ID.Value = id
|
||||
if fields := mpuo.fields; len(fields) > 0 {
|
||||
@@ -3604,6 +3732,60 @@ func (mpuo *MatchPlayerUpdateOne) sqlSave(ctx context.Context) (_node *MatchPlay
|
||||
}
|
||||
_spec.Edges.Add = append(_spec.Edges.Add, edge)
|
||||
}
|
||||
if mpuo.mutation.MessagesCleared() {
|
||||
edge := &sqlgraph.EdgeSpec{
|
||||
Rel: sqlgraph.O2M,
|
||||
Inverse: false,
|
||||
Table: matchplayer.MessagesTable,
|
||||
Columns: []string{matchplayer.MessagesColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: messages.FieldID,
|
||||
},
|
||||
},
|
||||
}
|
||||
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
||||
}
|
||||
if nodes := mpuo.mutation.RemovedMessagesIDs(); len(nodes) > 0 && !mpuo.mutation.MessagesCleared() {
|
||||
edge := &sqlgraph.EdgeSpec{
|
||||
Rel: sqlgraph.O2M,
|
||||
Inverse: false,
|
||||
Table: matchplayer.MessagesTable,
|
||||
Columns: []string{matchplayer.MessagesColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: messages.FieldID,
|
||||
},
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
edge.Target.Nodes = append(edge.Target.Nodes, k)
|
||||
}
|
||||
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
||||
}
|
||||
if nodes := mpuo.mutation.MessagesIDs(); len(nodes) > 0 {
|
||||
edge := &sqlgraph.EdgeSpec{
|
||||
Rel: sqlgraph.O2M,
|
||||
Inverse: false,
|
||||
Table: matchplayer.MessagesTable,
|
||||
Columns: []string{matchplayer.MessagesColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: messages.FieldID,
|
||||
},
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
edge.Target.Nodes = append(edge.Target.Nodes, k)
|
||||
}
|
||||
_spec.Edges.Add = append(_spec.Edges.Add, edge)
|
||||
}
|
||||
_node = &MatchPlayer{config: mpuo.config}
|
||||
_spec.Assign = _node.assignValues
|
||||
_spec.ScanValues = _node.scanValues
|
||||
|
Reference in New Issue
Block a user