func (mwpnuo *MessageWithPackageNameUpdateOne) Exec(ctx context.Context) error {
	_, err := mwpnuo.Save(ctx)
	return err
}
Exec executes the query on the entity.
package ent
import (
	"context"
	"fmt"
	"entgo.io/contrib/entproto/internal/entprototest/ent/messagewithpackagename"
	"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 MessageWithPackageNameUpdate struct {
	config
	hooks    []Hook
	mutation *MessageWithPackageNameMutation
}
func (mwpnu *MessageWithPackageNameUpdate) Where(ps ...predicate.MessageWithPackageName) *MessageWithPackageNameUpdate {
	mwpnu.mutation.Where(ps...)
	return mwpnu
}
func (mwpnu *MessageWithPackageNameUpdate) SetName(s string) *MessageWithPackageNameUpdate {
	mwpnu.mutation.SetName(s)
	return mwpnu
}
func (mwpnu *MessageWithPackageNameUpdate) Mutation() *MessageWithPackageNameMutation {
	return mwpnu.mutation
}
func (mwpnu *MessageWithPackageNameUpdate) Save(ctx context.Context) (int, error) {
	var (
		err      error
		affected int
	)
	if len(mwpnu.hooks) == 0 {
		affected, err = mwpnu.sqlSave(ctx)
	} else {
		var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
			mutation, ok := m.(*MessageWithPackageNameMutation)
			if !ok {
				return nil, fmt.Errorf("unexpected mutation type %T", m)
			}
			mwpnu.mutation = mutation
			affected, err = mwpnu.sqlSave(ctx)
			mutation.done = true
			return affected, err
		})
		for i := len(mwpnu.hooks) - 1; i >= 0; i-- {
			if mwpnu.hooks[i] == nil {
				return 0, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)")
			}
			mut = mwpnu.hooks[i](mut)
		}
		if _, err := mut.Mutate(ctx, mwpnu.mutation); err != nil {
			return 0, err
		}
	}
	return affected, err
}
func (mwpnu *MessageWithPackageNameUpdate) SaveX(ctx context.Context) int {
	affected, err := mwpnu.Save(ctx)
	if err != nil {
		panic(err)
	}
	return affected
}
func (mwpnu *MessageWithPackageNameUpdate) Exec(ctx context.Context) error {
	_, err := mwpnu.Save(ctx)
	return err
}
func (mwpnu *MessageWithPackageNameUpdate) ExecX(ctx context.Context) {
	if err := mwpnu.Exec(ctx); err != nil {
		panic(err)
	}
}
func (mwpnu *MessageWithPackageNameUpdate) sqlSave(ctx context.Context) (n int, err error) {
	_spec := &sqlgraph.UpdateSpec{
		Node: &sqlgraph.NodeSpec{
			Table:   messagewithpackagename.Table,
			Columns: messagewithpackagename.Columns,
			ID: &sqlgraph.FieldSpec{
				Type:   field.TypeInt,
				Column: messagewithpackagename.FieldID,
			},
		},
	}
	if ps := mwpnu.mutation.predicates; len(ps) > 0 {
		_spec.Predicate = func(selector *sql.Selector) {
			for i := range ps {
				ps[i](selector)
			}
		}
	}
	if value, ok := mwpnu.mutation.Name(); ok {
		_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
			Type:   field.TypeString,
			Value:  value,
			Column: messagewithpackagename.FieldName,
		})
	}
	if n, err = sqlgraph.UpdateNodes(ctx, mwpnu.driver, _spec); err != nil {
		if _, ok := err.(*sqlgraph.NotFoundError); ok {
			err = &NotFoundError{messagewithpackagename.Label}
		} else if sqlgraph.IsConstraintError(err) {
			err = &ConstraintError{err.Error(), err}
		}
		return 0, err
	}
	return n, nil
}
type MessageWithPackageNameUpdateOne struct {
	config
	fields   []string
	hooks    []Hook
	mutation *MessageWithPackageNameMutation
}
func (mwpnuo *MessageWithPackageNameUpdateOne) SetName(s string) *MessageWithPackageNameUpdateOne {
	mwpnuo.mutation.SetName(s)
	return mwpnuo
}
func (mwpnuo *MessageWithPackageNameUpdateOne) Mutation() *MessageWithPackageNameMutation {
	return mwpnuo.mutation
}
func (mwpnuo *MessageWithPackageNameUpdateOne) Select(field string, fields ...string) *MessageWithPackageNameUpdateOne {
	mwpnuo.fields = append([]string{field}, fields...)
	return mwpnuo
}
func (mwpnuo *MessageWithPackageNameUpdateOne) Save(ctx context.Context) (*MessageWithPackageName, error) {
	var (
		err  error
		node *MessageWithPackageName
	)
	if len(mwpnuo.hooks) == 0 {
		node, err = mwpnuo.sqlSave(ctx)
	} else {
		var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
			mutation, ok := m.(*MessageWithPackageNameMutation)
			if !ok {
				return nil, fmt.Errorf("unexpected mutation type %T", m)
			}
			mwpnuo.mutation = mutation
			node, err = mwpnuo.sqlSave(ctx)
			mutation.done = true
			return node, err
		})
		for i := len(mwpnuo.hooks) - 1; i >= 0; i-- {
			if mwpnuo.hooks[i] == nil {
				return nil, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)")
			}
			mut = mwpnuo.hooks[i](mut)
		}
		if _, err := mut.Mutate(ctx, mwpnuo.mutation); err != nil {
			return nil, err
		}
	}
	return node, err
}
func (mwpnuo *MessageWithPackageNameUpdateOne) SaveX(ctx context.Context) *MessageWithPackageName {
	node, err := mwpnuo.Save(ctx)
	if err != nil {
		panic(err)
	}
	return node
}