func (mwiuo *MessageWithIDUpdateOne) Mutation() *MessageWithIDMutation {
	return mwiuo.mutation
}
Mutation returns the MessageWithIDMutation object of the builder.
package ent
import (
	"context"
	"fmt"
	"entgo.io/contrib/entproto/internal/entprototest/ent/messagewithid"
	"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 MessageWithIDUpdate struct {
	config
	hooks    []Hook
	mutation *MessageWithIDMutation
}
func (mwiu *MessageWithIDUpdate) Where(ps ...predicate.MessageWithID) *MessageWithIDUpdate {
	mwiu.mutation.Where(ps...)
	return mwiu
}
func (mwiu *MessageWithIDUpdate) Mutation() *MessageWithIDMutation {
	return mwiu.mutation
}
func (mwiu *MessageWithIDUpdate) Save(ctx context.Context) (int, error) {
	var (
		err      error
		affected int
	)
	if len(mwiu.hooks) == 0 {
		affected, err = mwiu.sqlSave(ctx)
	} else {
		var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
			mutation, ok := m.(*MessageWithIDMutation)
			if !ok {
				return nil, fmt.Errorf("unexpected mutation type %T", m)
			}
			mwiu.mutation = mutation
			affected, err = mwiu.sqlSave(ctx)
			mutation.done = true
			return affected, err
		})
		for i := len(mwiu.hooks) - 1; i >= 0; i-- {
			if mwiu.hooks[i] == nil {
				return 0, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)")
			}
			mut = mwiu.hooks[i](mut)
		}
		if _, err := mut.Mutate(ctx, mwiu.mutation); err != nil {
			return 0, err
		}
	}
	return affected, err
}
func (mwiu *MessageWithIDUpdate) SaveX(ctx context.Context) int {
	affected, err := mwiu.Save(ctx)
	if err != nil {
		panic(err)
	}
	return affected
}
func (mwiu *MessageWithIDUpdate) Exec(ctx context.Context) error {
	_, err := mwiu.Save(ctx)
	return err
}
func (mwiu *MessageWithIDUpdate) ExecX(ctx context.Context) {
	if err := mwiu.Exec(ctx); err != nil {
		panic(err)
	}
}
func (mwiu *MessageWithIDUpdate) sqlSave(ctx context.Context) (n int, err error) {
	_spec := &sqlgraph.UpdateSpec{
		Node: &sqlgraph.NodeSpec{
			Table:   messagewithid.Table,
			Columns: messagewithid.Columns,
			ID: &sqlgraph.FieldSpec{
				Type:   field.TypeInt32,
				Column: messagewithid.FieldID,
			},
		},
	}
	if ps := mwiu.mutation.predicates; len(ps) > 0 {
		_spec.Predicate = func(selector *sql.Selector) {
			for i := range ps {
				ps[i](selector)
			}
		}
	}
	if n, err = sqlgraph.UpdateNodes(ctx, mwiu.driver, _spec); err != nil {
		if _, ok := err.(*sqlgraph.NotFoundError); ok {
			err = &NotFoundError{messagewithid.Label}
		} else if sqlgraph.IsConstraintError(err) {
			err = &ConstraintError{err.Error(), err}
		}
		return 0, err
	}
	return n, nil
}
type MessageWithIDUpdateOne struct {
	config
	fields   []string
	hooks    []Hook
	mutation *MessageWithIDMutation
}