func (mwfouo *MessageWithFieldOneUpdateOne) ExecX(ctx context.Context) {
	if err := mwfouo.Exec(ctx); err != nil {
		panic(err)
	}
}
ExecX is like Exec, but panics if an error occurs.
package ent
import (
	"context"
	"fmt"
	"entgo.io/contrib/entproto/internal/entprototest/ent/messagewithfieldone"
	"entgo.io/contrib/entproto/internal/entprototest/ent/predicate"
	"entgo.io/ent/dialect/sql"
	"entgo.io/ent/dialect/sql/sqlgraph"
	"entgo.io/ent/schema/field"
)
type MessageWithFieldOneUpdate struct {
	config
	hooks    []Hook
	mutation *MessageWithFieldOneMutation
}
func (mwfou *MessageWithFieldOneUpdate) Where(ps ...predicate.MessageWithFieldOne) *MessageWithFieldOneUpdate {
	mwfou.mutation.Where(ps...)
	return mwfou
}
func (mwfou *MessageWithFieldOneUpdate) SetFieldOne(i int32) *MessageWithFieldOneUpdate {
	mwfou.mutation.ResetFieldOne()
	mwfou.mutation.SetFieldOne(i)
	return mwfou
}
func (mwfou *MessageWithFieldOneUpdate) AddFieldOne(i int32) *MessageWithFieldOneUpdate {
	mwfou.mutation.AddFieldOne(i)
	return mwfou
}
func (mwfou *MessageWithFieldOneUpdate) Mutation() *MessageWithFieldOneMutation {
	return mwfou.mutation
}
func (mwfou *MessageWithFieldOneUpdate) Save(ctx context.Context) (int, error) {
	var (
		err      error
		affected int
	)
	if len(mwfou.hooks) == 0 {
		affected, err = mwfou.sqlSave(ctx)
	} else {
		var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
			mutation, ok := m.(*MessageWithFieldOneMutation)
			if !ok {
				return nil, fmt.Errorf("unexpected mutation type %T", m)
			}
			mwfou.mutation = mutation
			affected, err = mwfou.sqlSave(ctx)
			mutation.done = true
			return affected, err
		})
		for i := len(mwfou.hooks) - 1; i >= 0; i-- {
			if mwfou.hooks[i] == nil {
				return 0, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)")
			}
			mut = mwfou.hooks[i](mut)
		}
		if _, err := mut.Mutate(ctx, mwfou.mutation); err != nil {
			return 0, err
		}
	}
	return affected, err
}
func (mwfou *MessageWithFieldOneUpdate) SaveX(ctx context.Context) int {
	affected, err := mwfou.Save(ctx)
	if err != nil {
		panic(err)
	}
	return affected
}
func (mwfou *MessageWithFieldOneUpdate) Exec(ctx context.Context) error {
	_, err := mwfou.Save(ctx)
	return err
}
func (mwfou *MessageWithFieldOneUpdate) ExecX(ctx context.Context) {
	if err := mwfou.Exec(ctx); err != nil {
		panic(err)
	}
}
func (mwfou *MessageWithFieldOneUpdate) sqlSave(ctx context.Context) (n int, err error) {
	_spec := &sqlgraph.UpdateSpec{
		Node: &sqlgraph.NodeSpec{
			Table:   messagewithfieldone.Table,
			Columns: messagewithfieldone.Columns,
			ID: &sqlgraph.FieldSpec{
				Type:   field.TypeInt,
				Column: messagewithfieldone.FieldID,
			},
		},
	}
	if ps := mwfou.mutation.predicates; len(ps) > 0 {
		_spec.Predicate = func(selector *sql.Selector) {
			for i := range ps {
				ps[i](selector)
			}
		}
	}
	if value, ok := mwfou.mutation.FieldOne(); ok {
		_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
			Type:   field.TypeInt32,
			Value:  value,
			Column: messagewithfieldone.FieldFieldOne,
		})
	}
	if value, ok := mwfou.mutation.AddedFieldOne(); ok {
		_spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{
			Type:   field.TypeInt32,
			Value:  value,
			Column: messagewithfieldone.FieldFieldOne,
		})
	}
	if n, err = sqlgraph.UpdateNodes(ctx, mwfou.driver, _spec); err != nil {
		if _, ok := err.(*sqlgraph.NotFoundError); ok {
			err = &NotFoundError{messagewithfieldone.Label}
		} else if sqlgraph.IsConstraintError(err) {
			err = &ConstraintError{err.Error(), err}
		}
		return 0, err
	}
	return n, nil
}
type MessageWithFieldOneUpdateOne struct {
	config
	fields   []string
	hooks    []Hook
	mutation *MessageWithFieldOneMutation
}
func (mwfouo *MessageWithFieldOneUpdateOne) SetFieldOne(i int32) *MessageWithFieldOneUpdateOne {
	mwfouo.mutation.ResetFieldOne()
	mwfouo.mutation.SetFieldOne(i)
	return mwfouo
}
func (mwfouo *MessageWithFieldOneUpdateOne) AddFieldOne(i int32) *MessageWithFieldOneUpdateOne {
	mwfouo.mutation.AddFieldOne(i)
	return mwfouo
}
func (mwfouo *MessageWithFieldOneUpdateOne) Mutation() *MessageWithFieldOneMutation {
	return mwfouo.mutation
}
func (mwfouo *MessageWithFieldOneUpdateOne) Select(field string, fields ...string) *MessageWithFieldOneUpdateOne {
	mwfouo.fields = append([]string{field}, fields...)
	return mwfouo
}
func (mwfouo *MessageWithFieldOneUpdateOne) Save(ctx context.Context) (*MessageWithFieldOne, error) {
	var (
		err  error
		node *MessageWithFieldOne
	)
	if len(mwfouo.hooks) == 0 {
		node, err = mwfouo.sqlSave(ctx)
	} else {
		var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
			mutation, ok := m.(*MessageWithFieldOneMutation)
			if !ok {
				return nil, fmt.Errorf("unexpected mutation type %T", m)
			}
			mwfouo.mutation = mutation
			node, err = mwfouo.sqlSave(ctx)
			mutation.done = true
			return node, err
		})
		for i := len(mwfouo.hooks) - 1; i >= 0; i-- {
			if mwfouo.hooks[i] == nil {
				return nil, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)")
			}
			mut = mwfouo.hooks[i](mut)
		}
		if _, err := mut.Mutate(ctx, mwfouo.mutation); err != nil {
			return nil, err
		}
	}
	return node, err
}
func (mwfouo *MessageWithFieldOneUpdateOne) SaveX(ctx context.Context) *MessageWithFieldOne {
	node, err := mwfouo.Save(ctx)
	if err != nil {
		panic(err)
	}
	return node
}
func (mwfouo *MessageWithFieldOneUpdateOne) Exec(ctx context.Context) error {
	_, err := mwfouo.Save(ctx)
	return err
}