regenerate ent
This commit is contained in:
@@ -24,101 +24,133 @@ type WeaponUpdate struct {
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the WeaponUpdate builder.
|
||||
func (wu *WeaponUpdate) Where(ps ...predicate.Weapon) *WeaponUpdate {
|
||||
wu.mutation.Where(ps...)
|
||||
return wu
|
||||
func (_u *WeaponUpdate) Where(ps ...predicate.Weapon) *WeaponUpdate {
|
||||
_u.mutation.Where(ps...)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetVictim sets the "victim" field.
|
||||
func (wu *WeaponUpdate) SetVictim(u uint64) *WeaponUpdate {
|
||||
wu.mutation.ResetVictim()
|
||||
wu.mutation.SetVictim(u)
|
||||
return wu
|
||||
func (_u *WeaponUpdate) SetVictim(v uint64) *WeaponUpdate {
|
||||
_u.mutation.ResetVictim()
|
||||
_u.mutation.SetVictim(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddVictim adds u to the "victim" field.
|
||||
func (wu *WeaponUpdate) AddVictim(u int64) *WeaponUpdate {
|
||||
wu.mutation.AddVictim(u)
|
||||
return wu
|
||||
// SetNillableVictim sets the "victim" field if the given value is not nil.
|
||||
func (_u *WeaponUpdate) SetNillableVictim(v *uint64) *WeaponUpdate {
|
||||
if v != nil {
|
||||
_u.SetVictim(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddVictim adds value to the "victim" field.
|
||||
func (_u *WeaponUpdate) AddVictim(v int64) *WeaponUpdate {
|
||||
_u.mutation.AddVictim(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetDmg sets the "dmg" field.
|
||||
func (wu *WeaponUpdate) SetDmg(u uint) *WeaponUpdate {
|
||||
wu.mutation.ResetDmg()
|
||||
wu.mutation.SetDmg(u)
|
||||
return wu
|
||||
func (_u *WeaponUpdate) SetDmg(v uint) *WeaponUpdate {
|
||||
_u.mutation.ResetDmg()
|
||||
_u.mutation.SetDmg(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddDmg adds u to the "dmg" field.
|
||||
func (wu *WeaponUpdate) AddDmg(u int) *WeaponUpdate {
|
||||
wu.mutation.AddDmg(u)
|
||||
return wu
|
||||
// SetNillableDmg sets the "dmg" field if the given value is not nil.
|
||||
func (_u *WeaponUpdate) SetNillableDmg(v *uint) *WeaponUpdate {
|
||||
if v != nil {
|
||||
_u.SetDmg(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddDmg adds value to the "dmg" field.
|
||||
func (_u *WeaponUpdate) AddDmg(v int) *WeaponUpdate {
|
||||
_u.mutation.AddDmg(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetEqType sets the "eq_type" field.
|
||||
func (wu *WeaponUpdate) SetEqType(i int) *WeaponUpdate {
|
||||
wu.mutation.ResetEqType()
|
||||
wu.mutation.SetEqType(i)
|
||||
return wu
|
||||
func (_u *WeaponUpdate) SetEqType(v int) *WeaponUpdate {
|
||||
_u.mutation.ResetEqType()
|
||||
_u.mutation.SetEqType(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddEqType adds i to the "eq_type" field.
|
||||
func (wu *WeaponUpdate) AddEqType(i int) *WeaponUpdate {
|
||||
wu.mutation.AddEqType(i)
|
||||
return wu
|
||||
// SetNillableEqType sets the "eq_type" field if the given value is not nil.
|
||||
func (_u *WeaponUpdate) SetNillableEqType(v *int) *WeaponUpdate {
|
||||
if v != nil {
|
||||
_u.SetEqType(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddEqType adds value to the "eq_type" field.
|
||||
func (_u *WeaponUpdate) AddEqType(v int) *WeaponUpdate {
|
||||
_u.mutation.AddEqType(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetHitGroup sets the "hit_group" field.
|
||||
func (wu *WeaponUpdate) SetHitGroup(i int) *WeaponUpdate {
|
||||
wu.mutation.ResetHitGroup()
|
||||
wu.mutation.SetHitGroup(i)
|
||||
return wu
|
||||
func (_u *WeaponUpdate) SetHitGroup(v int) *WeaponUpdate {
|
||||
_u.mutation.ResetHitGroup()
|
||||
_u.mutation.SetHitGroup(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddHitGroup adds i to the "hit_group" field.
|
||||
func (wu *WeaponUpdate) AddHitGroup(i int) *WeaponUpdate {
|
||||
wu.mutation.AddHitGroup(i)
|
||||
return wu
|
||||
// SetNillableHitGroup sets the "hit_group" field if the given value is not nil.
|
||||
func (_u *WeaponUpdate) SetNillableHitGroup(v *int) *WeaponUpdate {
|
||||
if v != nil {
|
||||
_u.SetHitGroup(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddHitGroup adds value to the "hit_group" field.
|
||||
func (_u *WeaponUpdate) AddHitGroup(v int) *WeaponUpdate {
|
||||
_u.mutation.AddHitGroup(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetStatID sets the "stat" edge to the MatchPlayer entity by ID.
|
||||
func (wu *WeaponUpdate) SetStatID(id int) *WeaponUpdate {
|
||||
wu.mutation.SetStatID(id)
|
||||
return wu
|
||||
func (_u *WeaponUpdate) SetStatID(id int) *WeaponUpdate {
|
||||
_u.mutation.SetStatID(id)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableStatID sets the "stat" edge to the MatchPlayer entity by ID if the given value is not nil.
|
||||
func (wu *WeaponUpdate) SetNillableStatID(id *int) *WeaponUpdate {
|
||||
func (_u *WeaponUpdate) SetNillableStatID(id *int) *WeaponUpdate {
|
||||
if id != nil {
|
||||
wu = wu.SetStatID(*id)
|
||||
_u = _u.SetStatID(*id)
|
||||
}
|
||||
return wu
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetStat sets the "stat" edge to the MatchPlayer entity.
|
||||
func (wu *WeaponUpdate) SetStat(m *MatchPlayer) *WeaponUpdate {
|
||||
return wu.SetStatID(m.ID)
|
||||
func (_u *WeaponUpdate) SetStat(v *MatchPlayer) *WeaponUpdate {
|
||||
return _u.SetStatID(v.ID)
|
||||
}
|
||||
|
||||
// Mutation returns the WeaponMutation object of the builder.
|
||||
func (wu *WeaponUpdate) Mutation() *WeaponMutation {
|
||||
return wu.mutation
|
||||
func (_u *WeaponUpdate) Mutation() *WeaponMutation {
|
||||
return _u.mutation
|
||||
}
|
||||
|
||||
// ClearStat clears the "stat" edge to the MatchPlayer entity.
|
||||
func (wu *WeaponUpdate) ClearStat() *WeaponUpdate {
|
||||
wu.mutation.ClearStat()
|
||||
return wu
|
||||
func (_u *WeaponUpdate) ClearStat() *WeaponUpdate {
|
||||
_u.mutation.ClearStat()
|
||||
return _u
|
||||
}
|
||||
|
||||
// Save executes the query and returns the number of nodes affected by the update operation.
|
||||
func (wu *WeaponUpdate) Save(ctx context.Context) (int, error) {
|
||||
return withHooks(ctx, wu.sqlSave, wu.mutation, wu.hooks)
|
||||
func (_u *WeaponUpdate) Save(ctx context.Context) (int, error) {
|
||||
return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
|
||||
}
|
||||
|
||||
// SaveX is like Save, but panics if an error occurs.
|
||||
func (wu *WeaponUpdate) SaveX(ctx context.Context) int {
|
||||
affected, err := wu.Save(ctx)
|
||||
func (_u *WeaponUpdate) SaveX(ctx context.Context) int {
|
||||
affected, err := _u.Save(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -126,58 +158,58 @@ func (wu *WeaponUpdate) SaveX(ctx context.Context) int {
|
||||
}
|
||||
|
||||
// Exec executes the query.
|
||||
func (wu *WeaponUpdate) Exec(ctx context.Context) error {
|
||||
_, err := wu.Save(ctx)
|
||||
func (_u *WeaponUpdate) Exec(ctx context.Context) error {
|
||||
_, err := _u.Save(ctx)
|
||||
return err
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (wu *WeaponUpdate) ExecX(ctx context.Context) {
|
||||
if err := wu.Exec(ctx); err != nil {
|
||||
func (_u *WeaponUpdate) ExecX(ctx context.Context) {
|
||||
if err := _u.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
// Modify adds a statement modifier for attaching custom logic to the UPDATE statement.
|
||||
func (wu *WeaponUpdate) Modify(modifiers ...func(u *sql.UpdateBuilder)) *WeaponUpdate {
|
||||
wu.modifiers = append(wu.modifiers, modifiers...)
|
||||
return wu
|
||||
func (_u *WeaponUpdate) Modify(modifiers ...func(u *sql.UpdateBuilder)) *WeaponUpdate {
|
||||
_u.modifiers = append(_u.modifiers, modifiers...)
|
||||
return _u
|
||||
}
|
||||
|
||||
func (wu *WeaponUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
func (_u *WeaponUpdate) sqlSave(ctx context.Context) (_node int, err error) {
|
||||
_spec := sqlgraph.NewUpdateSpec(weapon.Table, weapon.Columns, sqlgraph.NewFieldSpec(weapon.FieldID, field.TypeInt))
|
||||
if ps := wu.mutation.predicates; len(ps) > 0 {
|
||||
if ps := _u.mutation.predicates; len(ps) > 0 {
|
||||
_spec.Predicate = func(selector *sql.Selector) {
|
||||
for i := range ps {
|
||||
ps[i](selector)
|
||||
}
|
||||
}
|
||||
}
|
||||
if value, ok := wu.mutation.Victim(); ok {
|
||||
if value, ok := _u.mutation.Victim(); ok {
|
||||
_spec.SetField(weapon.FieldVictim, field.TypeUint64, value)
|
||||
}
|
||||
if value, ok := wu.mutation.AddedVictim(); ok {
|
||||
if value, ok := _u.mutation.AddedVictim(); ok {
|
||||
_spec.AddField(weapon.FieldVictim, field.TypeUint64, value)
|
||||
}
|
||||
if value, ok := wu.mutation.Dmg(); ok {
|
||||
if value, ok := _u.mutation.Dmg(); ok {
|
||||
_spec.SetField(weapon.FieldDmg, field.TypeUint, value)
|
||||
}
|
||||
if value, ok := wu.mutation.AddedDmg(); ok {
|
||||
if value, ok := _u.mutation.AddedDmg(); ok {
|
||||
_spec.AddField(weapon.FieldDmg, field.TypeUint, value)
|
||||
}
|
||||
if value, ok := wu.mutation.EqType(); ok {
|
||||
if value, ok := _u.mutation.EqType(); ok {
|
||||
_spec.SetField(weapon.FieldEqType, field.TypeInt, value)
|
||||
}
|
||||
if value, ok := wu.mutation.AddedEqType(); ok {
|
||||
if value, ok := _u.mutation.AddedEqType(); ok {
|
||||
_spec.AddField(weapon.FieldEqType, field.TypeInt, value)
|
||||
}
|
||||
if value, ok := wu.mutation.HitGroup(); ok {
|
||||
if value, ok := _u.mutation.HitGroup(); ok {
|
||||
_spec.SetField(weapon.FieldHitGroup, field.TypeInt, value)
|
||||
}
|
||||
if value, ok := wu.mutation.AddedHitGroup(); ok {
|
||||
if value, ok := _u.mutation.AddedHitGroup(); ok {
|
||||
_spec.AddField(weapon.FieldHitGroup, field.TypeInt, value)
|
||||
}
|
||||
if wu.mutation.StatCleared() {
|
||||
if _u.mutation.StatCleared() {
|
||||
edge := &sqlgraph.EdgeSpec{
|
||||
Rel: sqlgraph.M2O,
|
||||
Inverse: true,
|
||||
@@ -190,7 +222,7 @@ func (wu *WeaponUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
}
|
||||
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
||||
}
|
||||
if nodes := wu.mutation.StatIDs(); len(nodes) > 0 {
|
||||
if nodes := _u.mutation.StatIDs(); len(nodes) > 0 {
|
||||
edge := &sqlgraph.EdgeSpec{
|
||||
Rel: sqlgraph.M2O,
|
||||
Inverse: true,
|
||||
@@ -206,8 +238,8 @@ func (wu *WeaponUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
}
|
||||
_spec.Edges.Add = append(_spec.Edges.Add, edge)
|
||||
}
|
||||
_spec.AddModifiers(wu.modifiers...)
|
||||
if n, err = sqlgraph.UpdateNodes(ctx, wu.driver, _spec); err != nil {
|
||||
_spec.AddModifiers(_u.modifiers...)
|
||||
if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil {
|
||||
if _, ok := err.(*sqlgraph.NotFoundError); ok {
|
||||
err = &NotFoundError{weapon.Label}
|
||||
} else if sqlgraph.IsConstraintError(err) {
|
||||
@@ -215,8 +247,8 @@ func (wu *WeaponUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
}
|
||||
return 0, err
|
||||
}
|
||||
wu.mutation.done = true
|
||||
return n, nil
|
||||
_u.mutation.done = true
|
||||
return _node, nil
|
||||
}
|
||||
|
||||
// WeaponUpdateOne is the builder for updating a single Weapon entity.
|
||||
@@ -229,108 +261,140 @@ type WeaponUpdateOne struct {
|
||||
}
|
||||
|
||||
// SetVictim sets the "victim" field.
|
||||
func (wuo *WeaponUpdateOne) SetVictim(u uint64) *WeaponUpdateOne {
|
||||
wuo.mutation.ResetVictim()
|
||||
wuo.mutation.SetVictim(u)
|
||||
return wuo
|
||||
func (_u *WeaponUpdateOne) SetVictim(v uint64) *WeaponUpdateOne {
|
||||
_u.mutation.ResetVictim()
|
||||
_u.mutation.SetVictim(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddVictim adds u to the "victim" field.
|
||||
func (wuo *WeaponUpdateOne) AddVictim(u int64) *WeaponUpdateOne {
|
||||
wuo.mutation.AddVictim(u)
|
||||
return wuo
|
||||
// SetNillableVictim sets the "victim" field if the given value is not nil.
|
||||
func (_u *WeaponUpdateOne) SetNillableVictim(v *uint64) *WeaponUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetVictim(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddVictim adds value to the "victim" field.
|
||||
func (_u *WeaponUpdateOne) AddVictim(v int64) *WeaponUpdateOne {
|
||||
_u.mutation.AddVictim(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetDmg sets the "dmg" field.
|
||||
func (wuo *WeaponUpdateOne) SetDmg(u uint) *WeaponUpdateOne {
|
||||
wuo.mutation.ResetDmg()
|
||||
wuo.mutation.SetDmg(u)
|
||||
return wuo
|
||||
func (_u *WeaponUpdateOne) SetDmg(v uint) *WeaponUpdateOne {
|
||||
_u.mutation.ResetDmg()
|
||||
_u.mutation.SetDmg(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddDmg adds u to the "dmg" field.
|
||||
func (wuo *WeaponUpdateOne) AddDmg(u int) *WeaponUpdateOne {
|
||||
wuo.mutation.AddDmg(u)
|
||||
return wuo
|
||||
// SetNillableDmg sets the "dmg" field if the given value is not nil.
|
||||
func (_u *WeaponUpdateOne) SetNillableDmg(v *uint) *WeaponUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetDmg(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddDmg adds value to the "dmg" field.
|
||||
func (_u *WeaponUpdateOne) AddDmg(v int) *WeaponUpdateOne {
|
||||
_u.mutation.AddDmg(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetEqType sets the "eq_type" field.
|
||||
func (wuo *WeaponUpdateOne) SetEqType(i int) *WeaponUpdateOne {
|
||||
wuo.mutation.ResetEqType()
|
||||
wuo.mutation.SetEqType(i)
|
||||
return wuo
|
||||
func (_u *WeaponUpdateOne) SetEqType(v int) *WeaponUpdateOne {
|
||||
_u.mutation.ResetEqType()
|
||||
_u.mutation.SetEqType(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddEqType adds i to the "eq_type" field.
|
||||
func (wuo *WeaponUpdateOne) AddEqType(i int) *WeaponUpdateOne {
|
||||
wuo.mutation.AddEqType(i)
|
||||
return wuo
|
||||
// SetNillableEqType sets the "eq_type" field if the given value is not nil.
|
||||
func (_u *WeaponUpdateOne) SetNillableEqType(v *int) *WeaponUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetEqType(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddEqType adds value to the "eq_type" field.
|
||||
func (_u *WeaponUpdateOne) AddEqType(v int) *WeaponUpdateOne {
|
||||
_u.mutation.AddEqType(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetHitGroup sets the "hit_group" field.
|
||||
func (wuo *WeaponUpdateOne) SetHitGroup(i int) *WeaponUpdateOne {
|
||||
wuo.mutation.ResetHitGroup()
|
||||
wuo.mutation.SetHitGroup(i)
|
||||
return wuo
|
||||
func (_u *WeaponUpdateOne) SetHitGroup(v int) *WeaponUpdateOne {
|
||||
_u.mutation.ResetHitGroup()
|
||||
_u.mutation.SetHitGroup(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddHitGroup adds i to the "hit_group" field.
|
||||
func (wuo *WeaponUpdateOne) AddHitGroup(i int) *WeaponUpdateOne {
|
||||
wuo.mutation.AddHitGroup(i)
|
||||
return wuo
|
||||
// SetNillableHitGroup sets the "hit_group" field if the given value is not nil.
|
||||
func (_u *WeaponUpdateOne) SetNillableHitGroup(v *int) *WeaponUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetHitGroup(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddHitGroup adds value to the "hit_group" field.
|
||||
func (_u *WeaponUpdateOne) AddHitGroup(v int) *WeaponUpdateOne {
|
||||
_u.mutation.AddHitGroup(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetStatID sets the "stat" edge to the MatchPlayer entity by ID.
|
||||
func (wuo *WeaponUpdateOne) SetStatID(id int) *WeaponUpdateOne {
|
||||
wuo.mutation.SetStatID(id)
|
||||
return wuo
|
||||
func (_u *WeaponUpdateOne) SetStatID(id int) *WeaponUpdateOne {
|
||||
_u.mutation.SetStatID(id)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableStatID sets the "stat" edge to the MatchPlayer entity by ID if the given value is not nil.
|
||||
func (wuo *WeaponUpdateOne) SetNillableStatID(id *int) *WeaponUpdateOne {
|
||||
func (_u *WeaponUpdateOne) SetNillableStatID(id *int) *WeaponUpdateOne {
|
||||
if id != nil {
|
||||
wuo = wuo.SetStatID(*id)
|
||||
_u = _u.SetStatID(*id)
|
||||
}
|
||||
return wuo
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetStat sets the "stat" edge to the MatchPlayer entity.
|
||||
func (wuo *WeaponUpdateOne) SetStat(m *MatchPlayer) *WeaponUpdateOne {
|
||||
return wuo.SetStatID(m.ID)
|
||||
func (_u *WeaponUpdateOne) SetStat(v *MatchPlayer) *WeaponUpdateOne {
|
||||
return _u.SetStatID(v.ID)
|
||||
}
|
||||
|
||||
// Mutation returns the WeaponMutation object of the builder.
|
||||
func (wuo *WeaponUpdateOne) Mutation() *WeaponMutation {
|
||||
return wuo.mutation
|
||||
func (_u *WeaponUpdateOne) Mutation() *WeaponMutation {
|
||||
return _u.mutation
|
||||
}
|
||||
|
||||
// ClearStat clears the "stat" edge to the MatchPlayer entity.
|
||||
func (wuo *WeaponUpdateOne) ClearStat() *WeaponUpdateOne {
|
||||
wuo.mutation.ClearStat()
|
||||
return wuo
|
||||
func (_u *WeaponUpdateOne) ClearStat() *WeaponUpdateOne {
|
||||
_u.mutation.ClearStat()
|
||||
return _u
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the WeaponUpdate builder.
|
||||
func (wuo *WeaponUpdateOne) Where(ps ...predicate.Weapon) *WeaponUpdateOne {
|
||||
wuo.mutation.Where(ps...)
|
||||
return wuo
|
||||
func (_u *WeaponUpdateOne) Where(ps ...predicate.Weapon) *WeaponUpdateOne {
|
||||
_u.mutation.Where(ps...)
|
||||
return _u
|
||||
}
|
||||
|
||||
// Select allows selecting one or more fields (columns) of the returned entity.
|
||||
// The default is selecting all fields defined in the entity schema.
|
||||
func (wuo *WeaponUpdateOne) Select(field string, fields ...string) *WeaponUpdateOne {
|
||||
wuo.fields = append([]string{field}, fields...)
|
||||
return wuo
|
||||
func (_u *WeaponUpdateOne) Select(field string, fields ...string) *WeaponUpdateOne {
|
||||
_u.fields = append([]string{field}, fields...)
|
||||
return _u
|
||||
}
|
||||
|
||||
// Save executes the query and returns the updated Weapon entity.
|
||||
func (wuo *WeaponUpdateOne) Save(ctx context.Context) (*Weapon, error) {
|
||||
return withHooks(ctx, wuo.sqlSave, wuo.mutation, wuo.hooks)
|
||||
func (_u *WeaponUpdateOne) Save(ctx context.Context) (*Weapon, error) {
|
||||
return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
|
||||
}
|
||||
|
||||
// SaveX is like Save, but panics if an error occurs.
|
||||
func (wuo *WeaponUpdateOne) SaveX(ctx context.Context) *Weapon {
|
||||
node, err := wuo.Save(ctx)
|
||||
func (_u *WeaponUpdateOne) SaveX(ctx context.Context) *Weapon {
|
||||
node, err := _u.Save(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -338,32 +402,32 @@ func (wuo *WeaponUpdateOne) SaveX(ctx context.Context) *Weapon {
|
||||
}
|
||||
|
||||
// Exec executes the query on the entity.
|
||||
func (wuo *WeaponUpdateOne) Exec(ctx context.Context) error {
|
||||
_, err := wuo.Save(ctx)
|
||||
func (_u *WeaponUpdateOne) Exec(ctx context.Context) error {
|
||||
_, err := _u.Save(ctx)
|
||||
return err
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (wuo *WeaponUpdateOne) ExecX(ctx context.Context) {
|
||||
if err := wuo.Exec(ctx); err != nil {
|
||||
func (_u *WeaponUpdateOne) ExecX(ctx context.Context) {
|
||||
if err := _u.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
// Modify adds a statement modifier for attaching custom logic to the UPDATE statement.
|
||||
func (wuo *WeaponUpdateOne) Modify(modifiers ...func(u *sql.UpdateBuilder)) *WeaponUpdateOne {
|
||||
wuo.modifiers = append(wuo.modifiers, modifiers...)
|
||||
return wuo
|
||||
func (_u *WeaponUpdateOne) Modify(modifiers ...func(u *sql.UpdateBuilder)) *WeaponUpdateOne {
|
||||
_u.modifiers = append(_u.modifiers, modifiers...)
|
||||
return _u
|
||||
}
|
||||
|
||||
func (wuo *WeaponUpdateOne) sqlSave(ctx context.Context) (_node *Weapon, err error) {
|
||||
func (_u *WeaponUpdateOne) sqlSave(ctx context.Context) (_node *Weapon, err error) {
|
||||
_spec := sqlgraph.NewUpdateSpec(weapon.Table, weapon.Columns, sqlgraph.NewFieldSpec(weapon.FieldID, field.TypeInt))
|
||||
id, ok := wuo.mutation.ID()
|
||||
id, ok := _u.mutation.ID()
|
||||
if !ok {
|
||||
return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "Weapon.id" for update`)}
|
||||
}
|
||||
_spec.Node.ID.Value = id
|
||||
if fields := wuo.fields; len(fields) > 0 {
|
||||
if fields := _u.fields; len(fields) > 0 {
|
||||
_spec.Node.Columns = make([]string, 0, len(fields))
|
||||
_spec.Node.Columns = append(_spec.Node.Columns, weapon.FieldID)
|
||||
for _, f := range fields {
|
||||
@@ -375,38 +439,38 @@ func (wuo *WeaponUpdateOne) sqlSave(ctx context.Context) (_node *Weapon, err err
|
||||
}
|
||||
}
|
||||
}
|
||||
if ps := wuo.mutation.predicates; len(ps) > 0 {
|
||||
if ps := _u.mutation.predicates; len(ps) > 0 {
|
||||
_spec.Predicate = func(selector *sql.Selector) {
|
||||
for i := range ps {
|
||||
ps[i](selector)
|
||||
}
|
||||
}
|
||||
}
|
||||
if value, ok := wuo.mutation.Victim(); ok {
|
||||
if value, ok := _u.mutation.Victim(); ok {
|
||||
_spec.SetField(weapon.FieldVictim, field.TypeUint64, value)
|
||||
}
|
||||
if value, ok := wuo.mutation.AddedVictim(); ok {
|
||||
if value, ok := _u.mutation.AddedVictim(); ok {
|
||||
_spec.AddField(weapon.FieldVictim, field.TypeUint64, value)
|
||||
}
|
||||
if value, ok := wuo.mutation.Dmg(); ok {
|
||||
if value, ok := _u.mutation.Dmg(); ok {
|
||||
_spec.SetField(weapon.FieldDmg, field.TypeUint, value)
|
||||
}
|
||||
if value, ok := wuo.mutation.AddedDmg(); ok {
|
||||
if value, ok := _u.mutation.AddedDmg(); ok {
|
||||
_spec.AddField(weapon.FieldDmg, field.TypeUint, value)
|
||||
}
|
||||
if value, ok := wuo.mutation.EqType(); ok {
|
||||
if value, ok := _u.mutation.EqType(); ok {
|
||||
_spec.SetField(weapon.FieldEqType, field.TypeInt, value)
|
||||
}
|
||||
if value, ok := wuo.mutation.AddedEqType(); ok {
|
||||
if value, ok := _u.mutation.AddedEqType(); ok {
|
||||
_spec.AddField(weapon.FieldEqType, field.TypeInt, value)
|
||||
}
|
||||
if value, ok := wuo.mutation.HitGroup(); ok {
|
||||
if value, ok := _u.mutation.HitGroup(); ok {
|
||||
_spec.SetField(weapon.FieldHitGroup, field.TypeInt, value)
|
||||
}
|
||||
if value, ok := wuo.mutation.AddedHitGroup(); ok {
|
||||
if value, ok := _u.mutation.AddedHitGroup(); ok {
|
||||
_spec.AddField(weapon.FieldHitGroup, field.TypeInt, value)
|
||||
}
|
||||
if wuo.mutation.StatCleared() {
|
||||
if _u.mutation.StatCleared() {
|
||||
edge := &sqlgraph.EdgeSpec{
|
||||
Rel: sqlgraph.M2O,
|
||||
Inverse: true,
|
||||
@@ -419,7 +483,7 @@ func (wuo *WeaponUpdateOne) sqlSave(ctx context.Context) (_node *Weapon, err err
|
||||
}
|
||||
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
||||
}
|
||||
if nodes := wuo.mutation.StatIDs(); len(nodes) > 0 {
|
||||
if nodes := _u.mutation.StatIDs(); len(nodes) > 0 {
|
||||
edge := &sqlgraph.EdgeSpec{
|
||||
Rel: sqlgraph.M2O,
|
||||
Inverse: true,
|
||||
@@ -435,11 +499,11 @@ func (wuo *WeaponUpdateOne) sqlSave(ctx context.Context) (_node *Weapon, err err
|
||||
}
|
||||
_spec.Edges.Add = append(_spec.Edges.Add, edge)
|
||||
}
|
||||
_spec.AddModifiers(wuo.modifiers...)
|
||||
_node = &Weapon{config: wuo.config}
|
||||
_spec.AddModifiers(_u.modifiers...)
|
||||
_node = &Weapon{config: _u.config}
|
||||
_spec.Assign = _node.assignValues
|
||||
_spec.ScanValues = _node.scanValues
|
||||
if err = sqlgraph.UpdateNode(ctx, wuo.driver, _spec); err != nil {
|
||||
if err = sqlgraph.UpdateNode(ctx, _u.driver, _spec); err != nil {
|
||||
if _, ok := err.(*sqlgraph.NotFoundError); ok {
|
||||
err = &NotFoundError{weapon.Label}
|
||||
} else if sqlgraph.IsConstraintError(err) {
|
||||
@@ -447,6 +511,6 @@ func (wuo *WeaponUpdateOne) sqlSave(ctx context.Context) (_node *Weapon, err err
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
wuo.mutation.done = true
|
||||
_u.mutation.done = true
|
||||
return _node, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user