func (wnfuo *WithNilFieldsUpdateOne) ExecX(ctx context.Context) {
	if err := wnfuo.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/withnilfields"
	"entgo.io/ent/dialect/sql"
	"entgo.io/ent/dialect/sql/sqlgraph"
	"entgo.io/ent/schema/field"
)
type WithNilFieldsUpdate struct {
	config
	hooks    []Hook
	mutation *WithNilFieldsMutation
}
func (wnfu *WithNilFieldsUpdate) Where(ps ...predicate.WithNilFields) *WithNilFieldsUpdate {
	wnfu.mutation.Where(ps...)
	return wnfu
}
func (wnfu *WithNilFieldsUpdate) Mutation() *WithNilFieldsMutation {
	return wnfu.mutation
}
func (wnfu *WithNilFieldsUpdate) Save(ctx context.Context) (int, error) {
	var (
		err      error
		affected int
	)
	if len(wnfu.hooks) == 0 {
		affected, err = wnfu.sqlSave(ctx)
	} else {
		var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
			mutation, ok := m.(*WithNilFieldsMutation)
			if !ok {
				return nil, fmt.Errorf("unexpected mutation type %T", m)
			}
			wnfu.mutation = mutation
			affected, err = wnfu.sqlSave(ctx)
			mutation.done = true
			return affected, err
		})
		for i := len(wnfu.hooks) - 1; i >= 0; i-- {
			if wnfu.hooks[i] == nil {
				return 0, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)")
			}
			mut = wnfu.hooks[i](mut)
		}
		if _, err := mut.Mutate(ctx, wnfu.mutation); err != nil {
			return 0, err
		}
	}
	return affected, err
}
func (wnfu *WithNilFieldsUpdate) SaveX(ctx context.Context) int {
	affected, err := wnfu.Save(ctx)
	if err != nil {
		panic(err)
	}
	return affected
}
func (wnfu *WithNilFieldsUpdate) Exec(ctx context.Context) error {
	_, err := wnfu.Save(ctx)
	return err
}
func (wnfu *WithNilFieldsUpdate) ExecX(ctx context.Context) {
	if err := wnfu.Exec(ctx); err != nil {
		panic(err)
	}
}
func (wnfu *WithNilFieldsUpdate) sqlSave(ctx context.Context) (n int, err error) {
	_spec := &sqlgraph.UpdateSpec{
		Node: &sqlgraph.NodeSpec{
			Table:   withnilfields.Table,
			Columns: withnilfields.Columns,
			ID: &sqlgraph.FieldSpec{
				Type:   field.TypeInt,
				Column: withnilfields.FieldID,
			},
		},
	}
	if ps := wnfu.mutation.predicates; len(ps) > 0 {
		_spec.Predicate = func(selector *sql.Selector) {
			for i := range ps {
				ps[i](selector)
			}
		}
	}
	if n, err = sqlgraph.UpdateNodes(ctx, wnfu.driver, _spec); err != nil {
		if _, ok := err.(*sqlgraph.NotFoundError); ok {
			err = &NotFoundError{withnilfields.Label}
		} else if sqlgraph.IsConstraintError(err) {
			err = &ConstraintError{err.Error(), err}
		}
		return 0, err
	}
	return n, nil
}
type WithNilFieldsUpdateOne struct {
	config
	fields   []string
	hooks    []Hook
	mutation *WithNilFieldsMutation
}
func (wnfuo *WithNilFieldsUpdateOne) Mutation() *WithNilFieldsMutation {
	return wnfuo.mutation
}
func (wnfuo *WithNilFieldsUpdateOne) Select(field string, fields ...string) *WithNilFieldsUpdateOne {
	wnfuo.fields = append([]string{field}, fields...)
	return wnfuo
}
func (wnfuo *WithNilFieldsUpdateOne) Save(ctx context.Context) (*WithNilFields, error) {
	var (
		err  error
		node *WithNilFields
	)
	if len(wnfuo.hooks) == 0 {
		node, err = wnfuo.sqlSave(ctx)
	} else {
		var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
			mutation, ok := m.(*WithNilFieldsMutation)
			if !ok {
				return nil, fmt.Errorf("unexpected mutation type %T", m)
			}
			wnfuo.mutation = mutation
			node, err = wnfuo.sqlSave(ctx)
			mutation.done = true
			return node, err
		})
		for i := len(wnfuo.hooks) - 1; i >= 0; i-- {
			if wnfuo.hooks[i] == nil {
				return nil, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)")
			}
			mut = wnfuo.hooks[i](mut)
		}
		if _, err := mut.Mutate(ctx, wnfuo.mutation); err != nil {
			return nil, err
		}
	}
	return node, err
}
func (wnfuo *WithNilFieldsUpdateOne) SaveX(ctx context.Context) *WithNilFields {
	node, err := wnfuo.Save(ctx)
	if err != nil {
		panic(err)
	}
	return node
}
func (wnfuo *WithNilFieldsUpdateOne) Exec(ctx context.Context) error {
	_, err := wnfuo.Save(ctx)
	return err
}