regenerate ent
This commit is contained in:
@@ -24,101 +24,133 @@ type RoundStatsUpdate struct {
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the RoundStatsUpdate builder.
|
||||
func (rsu *RoundStatsUpdate) Where(ps ...predicate.RoundStats) *RoundStatsUpdate {
|
||||
rsu.mutation.Where(ps...)
|
||||
return rsu
|
||||
func (_u *RoundStatsUpdate) Where(ps ...predicate.RoundStats) *RoundStatsUpdate {
|
||||
_u.mutation.Where(ps...)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetRound sets the "round" field.
|
||||
func (rsu *RoundStatsUpdate) SetRound(u uint) *RoundStatsUpdate {
|
||||
rsu.mutation.ResetRound()
|
||||
rsu.mutation.SetRound(u)
|
||||
return rsu
|
||||
func (_u *RoundStatsUpdate) SetRound(v uint) *RoundStatsUpdate {
|
||||
_u.mutation.ResetRound()
|
||||
_u.mutation.SetRound(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddRound adds u to the "round" field.
|
||||
func (rsu *RoundStatsUpdate) AddRound(u int) *RoundStatsUpdate {
|
||||
rsu.mutation.AddRound(u)
|
||||
return rsu
|
||||
// SetNillableRound sets the "round" field if the given value is not nil.
|
||||
func (_u *RoundStatsUpdate) SetNillableRound(v *uint) *RoundStatsUpdate {
|
||||
if v != nil {
|
||||
_u.SetRound(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddRound adds value to the "round" field.
|
||||
func (_u *RoundStatsUpdate) AddRound(v int) *RoundStatsUpdate {
|
||||
_u.mutation.AddRound(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetBank sets the "bank" field.
|
||||
func (rsu *RoundStatsUpdate) SetBank(u uint) *RoundStatsUpdate {
|
||||
rsu.mutation.ResetBank()
|
||||
rsu.mutation.SetBank(u)
|
||||
return rsu
|
||||
func (_u *RoundStatsUpdate) SetBank(v uint) *RoundStatsUpdate {
|
||||
_u.mutation.ResetBank()
|
||||
_u.mutation.SetBank(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddBank adds u to the "bank" field.
|
||||
func (rsu *RoundStatsUpdate) AddBank(u int) *RoundStatsUpdate {
|
||||
rsu.mutation.AddBank(u)
|
||||
return rsu
|
||||
// SetNillableBank sets the "bank" field if the given value is not nil.
|
||||
func (_u *RoundStatsUpdate) SetNillableBank(v *uint) *RoundStatsUpdate {
|
||||
if v != nil {
|
||||
_u.SetBank(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddBank adds value to the "bank" field.
|
||||
func (_u *RoundStatsUpdate) AddBank(v int) *RoundStatsUpdate {
|
||||
_u.mutation.AddBank(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetEquipment sets the "equipment" field.
|
||||
func (rsu *RoundStatsUpdate) SetEquipment(u uint) *RoundStatsUpdate {
|
||||
rsu.mutation.ResetEquipment()
|
||||
rsu.mutation.SetEquipment(u)
|
||||
return rsu
|
||||
func (_u *RoundStatsUpdate) SetEquipment(v uint) *RoundStatsUpdate {
|
||||
_u.mutation.ResetEquipment()
|
||||
_u.mutation.SetEquipment(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddEquipment adds u to the "equipment" field.
|
||||
func (rsu *RoundStatsUpdate) AddEquipment(u int) *RoundStatsUpdate {
|
||||
rsu.mutation.AddEquipment(u)
|
||||
return rsu
|
||||
// SetNillableEquipment sets the "equipment" field if the given value is not nil.
|
||||
func (_u *RoundStatsUpdate) SetNillableEquipment(v *uint) *RoundStatsUpdate {
|
||||
if v != nil {
|
||||
_u.SetEquipment(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddEquipment adds value to the "equipment" field.
|
||||
func (_u *RoundStatsUpdate) AddEquipment(v int) *RoundStatsUpdate {
|
||||
_u.mutation.AddEquipment(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetSpent sets the "spent" field.
|
||||
func (rsu *RoundStatsUpdate) SetSpent(u uint) *RoundStatsUpdate {
|
||||
rsu.mutation.ResetSpent()
|
||||
rsu.mutation.SetSpent(u)
|
||||
return rsu
|
||||
func (_u *RoundStatsUpdate) SetSpent(v uint) *RoundStatsUpdate {
|
||||
_u.mutation.ResetSpent()
|
||||
_u.mutation.SetSpent(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddSpent adds u to the "spent" field.
|
||||
func (rsu *RoundStatsUpdate) AddSpent(u int) *RoundStatsUpdate {
|
||||
rsu.mutation.AddSpent(u)
|
||||
return rsu
|
||||
// SetNillableSpent sets the "spent" field if the given value is not nil.
|
||||
func (_u *RoundStatsUpdate) SetNillableSpent(v *uint) *RoundStatsUpdate {
|
||||
if v != nil {
|
||||
_u.SetSpent(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddSpent adds value to the "spent" field.
|
||||
func (_u *RoundStatsUpdate) AddSpent(v int) *RoundStatsUpdate {
|
||||
_u.mutation.AddSpent(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetMatchPlayerID sets the "match_player" edge to the MatchPlayer entity by ID.
|
||||
func (rsu *RoundStatsUpdate) SetMatchPlayerID(id int) *RoundStatsUpdate {
|
||||
rsu.mutation.SetMatchPlayerID(id)
|
||||
return rsu
|
||||
func (_u *RoundStatsUpdate) SetMatchPlayerID(id int) *RoundStatsUpdate {
|
||||
_u.mutation.SetMatchPlayerID(id)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableMatchPlayerID sets the "match_player" edge to the MatchPlayer entity by ID if the given value is not nil.
|
||||
func (rsu *RoundStatsUpdate) SetNillableMatchPlayerID(id *int) *RoundStatsUpdate {
|
||||
func (_u *RoundStatsUpdate) SetNillableMatchPlayerID(id *int) *RoundStatsUpdate {
|
||||
if id != nil {
|
||||
rsu = rsu.SetMatchPlayerID(*id)
|
||||
_u = _u.SetMatchPlayerID(*id)
|
||||
}
|
||||
return rsu
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetMatchPlayer sets the "match_player" edge to the MatchPlayer entity.
|
||||
func (rsu *RoundStatsUpdate) SetMatchPlayer(m *MatchPlayer) *RoundStatsUpdate {
|
||||
return rsu.SetMatchPlayerID(m.ID)
|
||||
func (_u *RoundStatsUpdate) SetMatchPlayer(v *MatchPlayer) *RoundStatsUpdate {
|
||||
return _u.SetMatchPlayerID(v.ID)
|
||||
}
|
||||
|
||||
// Mutation returns the RoundStatsMutation object of the builder.
|
||||
func (rsu *RoundStatsUpdate) Mutation() *RoundStatsMutation {
|
||||
return rsu.mutation
|
||||
func (_u *RoundStatsUpdate) Mutation() *RoundStatsMutation {
|
||||
return _u.mutation
|
||||
}
|
||||
|
||||
// ClearMatchPlayer clears the "match_player" edge to the MatchPlayer entity.
|
||||
func (rsu *RoundStatsUpdate) ClearMatchPlayer() *RoundStatsUpdate {
|
||||
rsu.mutation.ClearMatchPlayer()
|
||||
return rsu
|
||||
func (_u *RoundStatsUpdate) ClearMatchPlayer() *RoundStatsUpdate {
|
||||
_u.mutation.ClearMatchPlayer()
|
||||
return _u
|
||||
}
|
||||
|
||||
// Save executes the query and returns the number of nodes affected by the update operation.
|
||||
func (rsu *RoundStatsUpdate) Save(ctx context.Context) (int, error) {
|
||||
return withHooks(ctx, rsu.sqlSave, rsu.mutation, rsu.hooks)
|
||||
func (_u *RoundStatsUpdate) 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 (rsu *RoundStatsUpdate) SaveX(ctx context.Context) int {
|
||||
affected, err := rsu.Save(ctx)
|
||||
func (_u *RoundStatsUpdate) SaveX(ctx context.Context) int {
|
||||
affected, err := _u.Save(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -126,58 +158,58 @@ func (rsu *RoundStatsUpdate) SaveX(ctx context.Context) int {
|
||||
}
|
||||
|
||||
// Exec executes the query.
|
||||
func (rsu *RoundStatsUpdate) Exec(ctx context.Context) error {
|
||||
_, err := rsu.Save(ctx)
|
||||
func (_u *RoundStatsUpdate) Exec(ctx context.Context) error {
|
||||
_, err := _u.Save(ctx)
|
||||
return err
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (rsu *RoundStatsUpdate) ExecX(ctx context.Context) {
|
||||
if err := rsu.Exec(ctx); err != nil {
|
||||
func (_u *RoundStatsUpdate) 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 (rsu *RoundStatsUpdate) Modify(modifiers ...func(u *sql.UpdateBuilder)) *RoundStatsUpdate {
|
||||
rsu.modifiers = append(rsu.modifiers, modifiers...)
|
||||
return rsu
|
||||
func (_u *RoundStatsUpdate) Modify(modifiers ...func(u *sql.UpdateBuilder)) *RoundStatsUpdate {
|
||||
_u.modifiers = append(_u.modifiers, modifiers...)
|
||||
return _u
|
||||
}
|
||||
|
||||
func (rsu *RoundStatsUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
func (_u *RoundStatsUpdate) sqlSave(ctx context.Context) (_node int, err error) {
|
||||
_spec := sqlgraph.NewUpdateSpec(roundstats.Table, roundstats.Columns, sqlgraph.NewFieldSpec(roundstats.FieldID, field.TypeInt))
|
||||
if ps := rsu.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 := rsu.mutation.Round(); ok {
|
||||
if value, ok := _u.mutation.Round(); ok {
|
||||
_spec.SetField(roundstats.FieldRound, field.TypeUint, value)
|
||||
}
|
||||
if value, ok := rsu.mutation.AddedRound(); ok {
|
||||
if value, ok := _u.mutation.AddedRound(); ok {
|
||||
_spec.AddField(roundstats.FieldRound, field.TypeUint, value)
|
||||
}
|
||||
if value, ok := rsu.mutation.Bank(); ok {
|
||||
if value, ok := _u.mutation.Bank(); ok {
|
||||
_spec.SetField(roundstats.FieldBank, field.TypeUint, value)
|
||||
}
|
||||
if value, ok := rsu.mutation.AddedBank(); ok {
|
||||
if value, ok := _u.mutation.AddedBank(); ok {
|
||||
_spec.AddField(roundstats.FieldBank, field.TypeUint, value)
|
||||
}
|
||||
if value, ok := rsu.mutation.Equipment(); ok {
|
||||
if value, ok := _u.mutation.Equipment(); ok {
|
||||
_spec.SetField(roundstats.FieldEquipment, field.TypeUint, value)
|
||||
}
|
||||
if value, ok := rsu.mutation.AddedEquipment(); ok {
|
||||
if value, ok := _u.mutation.AddedEquipment(); ok {
|
||||
_spec.AddField(roundstats.FieldEquipment, field.TypeUint, value)
|
||||
}
|
||||
if value, ok := rsu.mutation.Spent(); ok {
|
||||
if value, ok := _u.mutation.Spent(); ok {
|
||||
_spec.SetField(roundstats.FieldSpent, field.TypeUint, value)
|
||||
}
|
||||
if value, ok := rsu.mutation.AddedSpent(); ok {
|
||||
if value, ok := _u.mutation.AddedSpent(); ok {
|
||||
_spec.AddField(roundstats.FieldSpent, field.TypeUint, value)
|
||||
}
|
||||
if rsu.mutation.MatchPlayerCleared() {
|
||||
if _u.mutation.MatchPlayerCleared() {
|
||||
edge := &sqlgraph.EdgeSpec{
|
||||
Rel: sqlgraph.M2O,
|
||||
Inverse: true,
|
||||
@@ -190,7 +222,7 @@ func (rsu *RoundStatsUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
}
|
||||
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
||||
}
|
||||
if nodes := rsu.mutation.MatchPlayerIDs(); len(nodes) > 0 {
|
||||
if nodes := _u.mutation.MatchPlayerIDs(); len(nodes) > 0 {
|
||||
edge := &sqlgraph.EdgeSpec{
|
||||
Rel: sqlgraph.M2O,
|
||||
Inverse: true,
|
||||
@@ -206,8 +238,8 @@ func (rsu *RoundStatsUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
}
|
||||
_spec.Edges.Add = append(_spec.Edges.Add, edge)
|
||||
}
|
||||
_spec.AddModifiers(rsu.modifiers...)
|
||||
if n, err = sqlgraph.UpdateNodes(ctx, rsu.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{roundstats.Label}
|
||||
} else if sqlgraph.IsConstraintError(err) {
|
||||
@@ -215,8 +247,8 @@ func (rsu *RoundStatsUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
}
|
||||
return 0, err
|
||||
}
|
||||
rsu.mutation.done = true
|
||||
return n, nil
|
||||
_u.mutation.done = true
|
||||
return _node, nil
|
||||
}
|
||||
|
||||
// RoundStatsUpdateOne is the builder for updating a single RoundStats entity.
|
||||
@@ -229,108 +261,140 @@ type RoundStatsUpdateOne struct {
|
||||
}
|
||||
|
||||
// SetRound sets the "round" field.
|
||||
func (rsuo *RoundStatsUpdateOne) SetRound(u uint) *RoundStatsUpdateOne {
|
||||
rsuo.mutation.ResetRound()
|
||||
rsuo.mutation.SetRound(u)
|
||||
return rsuo
|
||||
func (_u *RoundStatsUpdateOne) SetRound(v uint) *RoundStatsUpdateOne {
|
||||
_u.mutation.ResetRound()
|
||||
_u.mutation.SetRound(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddRound adds u to the "round" field.
|
||||
func (rsuo *RoundStatsUpdateOne) AddRound(u int) *RoundStatsUpdateOne {
|
||||
rsuo.mutation.AddRound(u)
|
||||
return rsuo
|
||||
// SetNillableRound sets the "round" field if the given value is not nil.
|
||||
func (_u *RoundStatsUpdateOne) SetNillableRound(v *uint) *RoundStatsUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetRound(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddRound adds value to the "round" field.
|
||||
func (_u *RoundStatsUpdateOne) AddRound(v int) *RoundStatsUpdateOne {
|
||||
_u.mutation.AddRound(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetBank sets the "bank" field.
|
||||
func (rsuo *RoundStatsUpdateOne) SetBank(u uint) *RoundStatsUpdateOne {
|
||||
rsuo.mutation.ResetBank()
|
||||
rsuo.mutation.SetBank(u)
|
||||
return rsuo
|
||||
func (_u *RoundStatsUpdateOne) SetBank(v uint) *RoundStatsUpdateOne {
|
||||
_u.mutation.ResetBank()
|
||||
_u.mutation.SetBank(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddBank adds u to the "bank" field.
|
||||
func (rsuo *RoundStatsUpdateOne) AddBank(u int) *RoundStatsUpdateOne {
|
||||
rsuo.mutation.AddBank(u)
|
||||
return rsuo
|
||||
// SetNillableBank sets the "bank" field if the given value is not nil.
|
||||
func (_u *RoundStatsUpdateOne) SetNillableBank(v *uint) *RoundStatsUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetBank(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddBank adds value to the "bank" field.
|
||||
func (_u *RoundStatsUpdateOne) AddBank(v int) *RoundStatsUpdateOne {
|
||||
_u.mutation.AddBank(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetEquipment sets the "equipment" field.
|
||||
func (rsuo *RoundStatsUpdateOne) SetEquipment(u uint) *RoundStatsUpdateOne {
|
||||
rsuo.mutation.ResetEquipment()
|
||||
rsuo.mutation.SetEquipment(u)
|
||||
return rsuo
|
||||
func (_u *RoundStatsUpdateOne) SetEquipment(v uint) *RoundStatsUpdateOne {
|
||||
_u.mutation.ResetEquipment()
|
||||
_u.mutation.SetEquipment(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddEquipment adds u to the "equipment" field.
|
||||
func (rsuo *RoundStatsUpdateOne) AddEquipment(u int) *RoundStatsUpdateOne {
|
||||
rsuo.mutation.AddEquipment(u)
|
||||
return rsuo
|
||||
// SetNillableEquipment sets the "equipment" field if the given value is not nil.
|
||||
func (_u *RoundStatsUpdateOne) SetNillableEquipment(v *uint) *RoundStatsUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetEquipment(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddEquipment adds value to the "equipment" field.
|
||||
func (_u *RoundStatsUpdateOne) AddEquipment(v int) *RoundStatsUpdateOne {
|
||||
_u.mutation.AddEquipment(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetSpent sets the "spent" field.
|
||||
func (rsuo *RoundStatsUpdateOne) SetSpent(u uint) *RoundStatsUpdateOne {
|
||||
rsuo.mutation.ResetSpent()
|
||||
rsuo.mutation.SetSpent(u)
|
||||
return rsuo
|
||||
func (_u *RoundStatsUpdateOne) SetSpent(v uint) *RoundStatsUpdateOne {
|
||||
_u.mutation.ResetSpent()
|
||||
_u.mutation.SetSpent(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddSpent adds u to the "spent" field.
|
||||
func (rsuo *RoundStatsUpdateOne) AddSpent(u int) *RoundStatsUpdateOne {
|
||||
rsuo.mutation.AddSpent(u)
|
||||
return rsuo
|
||||
// SetNillableSpent sets the "spent" field if the given value is not nil.
|
||||
func (_u *RoundStatsUpdateOne) SetNillableSpent(v *uint) *RoundStatsUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetSpent(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddSpent adds value to the "spent" field.
|
||||
func (_u *RoundStatsUpdateOne) AddSpent(v int) *RoundStatsUpdateOne {
|
||||
_u.mutation.AddSpent(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetMatchPlayerID sets the "match_player" edge to the MatchPlayer entity by ID.
|
||||
func (rsuo *RoundStatsUpdateOne) SetMatchPlayerID(id int) *RoundStatsUpdateOne {
|
||||
rsuo.mutation.SetMatchPlayerID(id)
|
||||
return rsuo
|
||||
func (_u *RoundStatsUpdateOne) SetMatchPlayerID(id int) *RoundStatsUpdateOne {
|
||||
_u.mutation.SetMatchPlayerID(id)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableMatchPlayerID sets the "match_player" edge to the MatchPlayer entity by ID if the given value is not nil.
|
||||
func (rsuo *RoundStatsUpdateOne) SetNillableMatchPlayerID(id *int) *RoundStatsUpdateOne {
|
||||
func (_u *RoundStatsUpdateOne) SetNillableMatchPlayerID(id *int) *RoundStatsUpdateOne {
|
||||
if id != nil {
|
||||
rsuo = rsuo.SetMatchPlayerID(*id)
|
||||
_u = _u.SetMatchPlayerID(*id)
|
||||
}
|
||||
return rsuo
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetMatchPlayer sets the "match_player" edge to the MatchPlayer entity.
|
||||
func (rsuo *RoundStatsUpdateOne) SetMatchPlayer(m *MatchPlayer) *RoundStatsUpdateOne {
|
||||
return rsuo.SetMatchPlayerID(m.ID)
|
||||
func (_u *RoundStatsUpdateOne) SetMatchPlayer(v *MatchPlayer) *RoundStatsUpdateOne {
|
||||
return _u.SetMatchPlayerID(v.ID)
|
||||
}
|
||||
|
||||
// Mutation returns the RoundStatsMutation object of the builder.
|
||||
func (rsuo *RoundStatsUpdateOne) Mutation() *RoundStatsMutation {
|
||||
return rsuo.mutation
|
||||
func (_u *RoundStatsUpdateOne) Mutation() *RoundStatsMutation {
|
||||
return _u.mutation
|
||||
}
|
||||
|
||||
// ClearMatchPlayer clears the "match_player" edge to the MatchPlayer entity.
|
||||
func (rsuo *RoundStatsUpdateOne) ClearMatchPlayer() *RoundStatsUpdateOne {
|
||||
rsuo.mutation.ClearMatchPlayer()
|
||||
return rsuo
|
||||
func (_u *RoundStatsUpdateOne) ClearMatchPlayer() *RoundStatsUpdateOne {
|
||||
_u.mutation.ClearMatchPlayer()
|
||||
return _u
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the RoundStatsUpdate builder.
|
||||
func (rsuo *RoundStatsUpdateOne) Where(ps ...predicate.RoundStats) *RoundStatsUpdateOne {
|
||||
rsuo.mutation.Where(ps...)
|
||||
return rsuo
|
||||
func (_u *RoundStatsUpdateOne) Where(ps ...predicate.RoundStats) *RoundStatsUpdateOne {
|
||||
_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 (rsuo *RoundStatsUpdateOne) Select(field string, fields ...string) *RoundStatsUpdateOne {
|
||||
rsuo.fields = append([]string{field}, fields...)
|
||||
return rsuo
|
||||
func (_u *RoundStatsUpdateOne) Select(field string, fields ...string) *RoundStatsUpdateOne {
|
||||
_u.fields = append([]string{field}, fields...)
|
||||
return _u
|
||||
}
|
||||
|
||||
// Save executes the query and returns the updated RoundStats entity.
|
||||
func (rsuo *RoundStatsUpdateOne) Save(ctx context.Context) (*RoundStats, error) {
|
||||
return withHooks(ctx, rsuo.sqlSave, rsuo.mutation, rsuo.hooks)
|
||||
func (_u *RoundStatsUpdateOne) Save(ctx context.Context) (*RoundStats, error) {
|
||||
return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
|
||||
}
|
||||
|
||||
// SaveX is like Save, but panics if an error occurs.
|
||||
func (rsuo *RoundStatsUpdateOne) SaveX(ctx context.Context) *RoundStats {
|
||||
node, err := rsuo.Save(ctx)
|
||||
func (_u *RoundStatsUpdateOne) SaveX(ctx context.Context) *RoundStats {
|
||||
node, err := _u.Save(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -338,32 +402,32 @@ func (rsuo *RoundStatsUpdateOne) SaveX(ctx context.Context) *RoundStats {
|
||||
}
|
||||
|
||||
// Exec executes the query on the entity.
|
||||
func (rsuo *RoundStatsUpdateOne) Exec(ctx context.Context) error {
|
||||
_, err := rsuo.Save(ctx)
|
||||
func (_u *RoundStatsUpdateOne) Exec(ctx context.Context) error {
|
||||
_, err := _u.Save(ctx)
|
||||
return err
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (rsuo *RoundStatsUpdateOne) ExecX(ctx context.Context) {
|
||||
if err := rsuo.Exec(ctx); err != nil {
|
||||
func (_u *RoundStatsUpdateOne) 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 (rsuo *RoundStatsUpdateOne) Modify(modifiers ...func(u *sql.UpdateBuilder)) *RoundStatsUpdateOne {
|
||||
rsuo.modifiers = append(rsuo.modifiers, modifiers...)
|
||||
return rsuo
|
||||
func (_u *RoundStatsUpdateOne) Modify(modifiers ...func(u *sql.UpdateBuilder)) *RoundStatsUpdateOne {
|
||||
_u.modifiers = append(_u.modifiers, modifiers...)
|
||||
return _u
|
||||
}
|
||||
|
||||
func (rsuo *RoundStatsUpdateOne) sqlSave(ctx context.Context) (_node *RoundStats, err error) {
|
||||
func (_u *RoundStatsUpdateOne) sqlSave(ctx context.Context) (_node *RoundStats, err error) {
|
||||
_spec := sqlgraph.NewUpdateSpec(roundstats.Table, roundstats.Columns, sqlgraph.NewFieldSpec(roundstats.FieldID, field.TypeInt))
|
||||
id, ok := rsuo.mutation.ID()
|
||||
id, ok := _u.mutation.ID()
|
||||
if !ok {
|
||||
return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "RoundStats.id" for update`)}
|
||||
}
|
||||
_spec.Node.ID.Value = id
|
||||
if fields := rsuo.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, roundstats.FieldID)
|
||||
for _, f := range fields {
|
||||
@@ -375,38 +439,38 @@ func (rsuo *RoundStatsUpdateOne) sqlSave(ctx context.Context) (_node *RoundStats
|
||||
}
|
||||
}
|
||||
}
|
||||
if ps := rsuo.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 := rsuo.mutation.Round(); ok {
|
||||
if value, ok := _u.mutation.Round(); ok {
|
||||
_spec.SetField(roundstats.FieldRound, field.TypeUint, value)
|
||||
}
|
||||
if value, ok := rsuo.mutation.AddedRound(); ok {
|
||||
if value, ok := _u.mutation.AddedRound(); ok {
|
||||
_spec.AddField(roundstats.FieldRound, field.TypeUint, value)
|
||||
}
|
||||
if value, ok := rsuo.mutation.Bank(); ok {
|
||||
if value, ok := _u.mutation.Bank(); ok {
|
||||
_spec.SetField(roundstats.FieldBank, field.TypeUint, value)
|
||||
}
|
||||
if value, ok := rsuo.mutation.AddedBank(); ok {
|
||||
if value, ok := _u.mutation.AddedBank(); ok {
|
||||
_spec.AddField(roundstats.FieldBank, field.TypeUint, value)
|
||||
}
|
||||
if value, ok := rsuo.mutation.Equipment(); ok {
|
||||
if value, ok := _u.mutation.Equipment(); ok {
|
||||
_spec.SetField(roundstats.FieldEquipment, field.TypeUint, value)
|
||||
}
|
||||
if value, ok := rsuo.mutation.AddedEquipment(); ok {
|
||||
if value, ok := _u.mutation.AddedEquipment(); ok {
|
||||
_spec.AddField(roundstats.FieldEquipment, field.TypeUint, value)
|
||||
}
|
||||
if value, ok := rsuo.mutation.Spent(); ok {
|
||||
if value, ok := _u.mutation.Spent(); ok {
|
||||
_spec.SetField(roundstats.FieldSpent, field.TypeUint, value)
|
||||
}
|
||||
if value, ok := rsuo.mutation.AddedSpent(); ok {
|
||||
if value, ok := _u.mutation.AddedSpent(); ok {
|
||||
_spec.AddField(roundstats.FieldSpent, field.TypeUint, value)
|
||||
}
|
||||
if rsuo.mutation.MatchPlayerCleared() {
|
||||
if _u.mutation.MatchPlayerCleared() {
|
||||
edge := &sqlgraph.EdgeSpec{
|
||||
Rel: sqlgraph.M2O,
|
||||
Inverse: true,
|
||||
@@ -419,7 +483,7 @@ func (rsuo *RoundStatsUpdateOne) sqlSave(ctx context.Context) (_node *RoundStats
|
||||
}
|
||||
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
||||
}
|
||||
if nodes := rsuo.mutation.MatchPlayerIDs(); len(nodes) > 0 {
|
||||
if nodes := _u.mutation.MatchPlayerIDs(); len(nodes) > 0 {
|
||||
edge := &sqlgraph.EdgeSpec{
|
||||
Rel: sqlgraph.M2O,
|
||||
Inverse: true,
|
||||
@@ -435,11 +499,11 @@ func (rsuo *RoundStatsUpdateOne) sqlSave(ctx context.Context) (_node *RoundStats
|
||||
}
|
||||
_spec.Edges.Add = append(_spec.Edges.Add, edge)
|
||||
}
|
||||
_spec.AddModifiers(rsuo.modifiers...)
|
||||
_node = &RoundStats{config: rsuo.config}
|
||||
_spec.AddModifiers(_u.modifiers...)
|
||||
_node = &RoundStats{config: _u.config}
|
||||
_spec.Assign = _node.assignValues
|
||||
_spec.ScanValues = _node.scanValues
|
||||
if err = sqlgraph.UpdateNode(ctx, rsuo.driver, _spec); err != nil {
|
||||
if err = sqlgraph.UpdateNode(ctx, _u.driver, _spec); err != nil {
|
||||
if _, ok := err.(*sqlgraph.NotFoundError); ok {
|
||||
err = &NotFoundError{roundstats.Label}
|
||||
} else if sqlgraph.IsConstraintError(err) {
|
||||
@@ -447,6 +511,6 @@ func (rsuo *RoundStatsUpdateOne) sqlSave(ctx context.Context) (_node *RoundStats
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
rsuo.mutation.done = true
|
||||
_u.mutation.done = true
|
||||
return _node, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user