func (wmfuo *WithModifiedFieldUpdateOne) ExecX(ctx context.Context) {
	if err := wmfuo.Exec(ctx); err != nil {
		panic(err)
	}
}
ExecX is like Exec, but panics if an error occurs.
package ent
import (
	"context"
	"fmt"
	"entgo.io/contrib/schemast/internal/mutatetest/ent/predicate"
	"entgo.io/contrib/schemast/internal/mutatetest/ent/user"
	"entgo.io/contrib/schemast/internal/mutatetest/ent/withmodifiedfield"
	"entgo.io/ent/dialect/sql"
	"entgo.io/ent/dialect/sql/sqlgraph"
	"entgo.io/ent/schema/field"
)
type WithModifiedFieldUpdate struct {
	config
	hooks    []Hook
	mutation *WithModifiedFieldMutation
}
func (wmfu *WithModifiedFieldUpdate) Where(ps ...predicate.WithModifiedField) *WithModifiedFieldUpdate {
	wmfu.mutation.Where(ps...)
	return wmfu
}
func (wmfu *WithModifiedFieldUpdate) SetOwnerID(id int) *WithModifiedFieldUpdate {
	wmfu.mutation.SetOwnerID(id)
	return wmfu
}
func (wmfu *WithModifiedFieldUpdate) SetNillableOwnerID(id *int) *WithModifiedFieldUpdate {
	if id != nil {
		wmfu = wmfu.SetOwnerID(*id)
	}
	return wmfu
}
func (wmfu *WithModifiedFieldUpdate) SetOwner(u *User) *WithModifiedFieldUpdate {
	return wmfu.SetOwnerID(u.ID)
}
func (wmfu *WithModifiedFieldUpdate) Mutation() *WithModifiedFieldMutation {
	return wmfu.mutation
}
func (wmfu *WithModifiedFieldUpdate) ClearOwner() *WithModifiedFieldUpdate {
	wmfu.mutation.ClearOwner()
	return wmfu
}
func (wmfu *WithModifiedFieldUpdate) Save(ctx context.Context) (int, error) {
	var (
		err      error
		affected int
	)
	if len(wmfu.hooks) == 0 {
		affected, err = wmfu.sqlSave(ctx)
	} else {
		var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
			mutation, ok := m.(*WithModifiedFieldMutation)
			if !ok {
				return nil, fmt.Errorf("unexpected mutation type %T", m)
			}
			wmfu.mutation = mutation
			affected, err = wmfu.sqlSave(ctx)
			mutation.done = true
			return affected, err
		})
		for i := len(wmfu.hooks) - 1; i >= 0; i-- {
			if wmfu.hooks[i] == nil {
				return 0, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)")
			}
			mut = wmfu.hooks[i](mut)
		}
		if _, err := mut.Mutate(ctx, wmfu.mutation); err != nil {
			return 0, err
		}
	}
	return affected, err
}
func (wmfu *WithModifiedFieldUpdate) SaveX(ctx context.Context) int {
	affected, err := wmfu.Save(ctx)
	if err != nil {
		panic(err)
	}
	return affected
}
func (wmfu *WithModifiedFieldUpdate) Exec(ctx context.Context) error {
	_, err := wmfu.Save(ctx)
	return err
}
func (wmfu *WithModifiedFieldUpdate) ExecX(ctx context.Context) {
	if err := wmfu.Exec(ctx); err != nil {
		panic(err)
	}
}
func (wmfu *WithModifiedFieldUpdate) sqlSave(ctx context.Context) (n int, err error) {
	_spec := &sqlgraph.UpdateSpec{
		Node: &sqlgraph.NodeSpec{
			Table:   withmodifiedfield.Table,
			Columns: withmodifiedfield.Columns,
			ID: &sqlgraph.FieldSpec{
				Type:   field.TypeInt,
				Column: withmodifiedfield.FieldID,
			},
		},
	}
	if ps := wmfu.mutation.predicates; len(ps) > 0 {
		_spec.Predicate = func(selector *sql.Selector) {
			for i := range ps {
				ps[i](selector)
			}
		}
	}
	if wmfu.mutation.OwnerCleared() {
		edge := &sqlgraph.EdgeSpec{
			Rel:     sqlgraph.M2O,
			Inverse: false,
			Table:   withmodifiedfield.OwnerTable,
			Columns: []string{withmodifiedfield.OwnerColumn},
			Bidi:    false,
			Target: &sqlgraph.EdgeTarget{
				IDSpec: &sqlgraph.FieldSpec{
					Type:   field.TypeInt,
					Column: user.FieldID,
				},
			},
		}
		_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
	}
	if nodes := wmfu.mutation.OwnerIDs(); len(nodes) > 0 {
		edge := &sqlgraph.EdgeSpec{
			Rel:     sqlgraph.M2O,
			Inverse: false,
			Table:   withmodifiedfield.OwnerTable,
			Columns: []string{withmodifiedfield.OwnerColumn},
			Bidi:    false,
			Target: &sqlgraph.EdgeTarget{
				IDSpec: &sqlgraph.FieldSpec{
					Type:   field.TypeInt,
					Column: user.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, wmfu.driver, _spec); err != nil {
		if _, ok := err.(*sqlgraph.NotFoundError); ok {
			err = &NotFoundError{withmodifiedfield.Label}
		} else if sqlgraph.IsConstraintError(err) {
			err = &ConstraintError{err.Error(), err}
		}
		return 0, err
	}
	return n, nil
}
type WithModifiedFieldUpdateOne struct {
	config
	fields   []string
	hooks    []Hook
	mutation *WithModifiedFieldMutation
}
func (wmfuo *WithModifiedFieldUpdateOne) SetOwnerID(id int) *WithModifiedFieldUpdateOne {
	wmfuo.mutation.SetOwnerID(id)
	return wmfuo
}
func (wmfuo *WithModifiedFieldUpdateOne) SetNillableOwnerID(id *int) *WithModifiedFieldUpdateOne {
	if id != nil {
		wmfuo = wmfuo.SetOwnerID(*id)
	}
	return wmfuo
}
func (wmfuo *WithModifiedFieldUpdateOne) SetOwner(u *User) *WithModifiedFieldUpdateOne {
	return wmfuo.SetOwnerID(u.ID)
}
func (wmfuo *WithModifiedFieldUpdateOne) Mutation() *WithModifiedFieldMutation {
	return wmfuo.mutation
}
func (wmfuo *WithModifiedFieldUpdateOne) ClearOwner() *WithModifiedFieldUpdateOne {
	wmfuo.mutation.ClearOwner()
	return wmfuo
}
func (wmfuo *WithModifiedFieldUpdateOne) Select(field string, fields ...string) *WithModifiedFieldUpdateOne {
	wmfuo.fields = append([]string{field}, fields...)
	return wmfuo
}
func (wmfuo *WithModifiedFieldUpdateOne) Save(ctx context.Context) (*WithModifiedField, error) {
	var (
		err  error
		node *WithModifiedField
	)
	if len(wmfuo.hooks) == 0 {
		node, err = wmfuo.sqlSave(ctx)
	} else {
		var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
			mutation, ok := m.(*WithModifiedFieldMutation)
			if !ok {
				return nil, fmt.Errorf("unexpected mutation type %T", m)
			}
			wmfuo.mutation = mutation
			node, err = wmfuo.sqlSave(ctx)
			mutation.done = true
			return node, err
		})
		for i := len(wmfuo.hooks) - 1; i >= 0; i-- {
			if wmfuo.hooks[i] == nil {
				return nil, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)")
			}
			mut = wmfuo.hooks[i](mut)
		}
		if _, err := mut.Mutate(ctx, wmfuo.mutation); err != nil {
			return nil, err
		}
	}
	return node, err
}
func (wmfuo *WithModifiedFieldUpdateOne) SaveX(ctx context.Context) *WithModifiedField {
	node, err := wmfuo.Save(ctx)
	if err != nil {
		panic(err)
	}
	return node
}
func (wmfuo *WithModifiedFieldUpdateOne) Exec(ctx context.Context) error {
	_, err := wmfuo.Save(ctx)
	return err
}