func (mweu *MessageWithEnumUpdate) check() error {
	if v, ok := mweu.mutation.EnumType(); ok {
		if err := messagewithenum.EnumTypeValidator(v); err != nil {
			return &ValidationError{Name: "enum_type", err: fmt.Errorf("ent: validator failed for field \"enum_type\": %w", err)}
		}
	}
	if v, ok := mweu.mutation.EnumWithoutDefault(); ok {
		if err := messagewithenum.EnumWithoutDefaultValidator(v); err != nil {
			return &ValidationError{Name: "enum_without_default", err: fmt.Errorf("ent: validator failed for field \"enum_without_default\": %w", err)}
		}
	}
	return nil
}
check runs all checks and user-defined validators on the builder.
package ent
import (
	"context"
	"fmt"
	"entgo.io/contrib/entproto/internal/entprototest/ent/messagewithenum"
	"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 MessageWithEnumUpdate struct {
	config
	hooks    []Hook
	mutation *MessageWithEnumMutation
}
func (mweu *MessageWithEnumUpdate) Where(ps ...predicate.MessageWithEnum) *MessageWithEnumUpdate {
	mweu.mutation.Where(ps...)
	return mweu
}
func (mweu *MessageWithEnumUpdate) SetEnumType(mt messagewithenum.EnumType) *MessageWithEnumUpdate {
	mweu.mutation.SetEnumType(mt)
	return mweu
}
func (mweu *MessageWithEnumUpdate) SetNillableEnumType(mt *messagewithenum.EnumType) *MessageWithEnumUpdate {
	if mt != nil {
		mweu.SetEnumType(*mt)
	}
	return mweu
}
func (mweu *MessageWithEnumUpdate) SetEnumWithoutDefault(mwd messagewithenum.EnumWithoutDefault) *MessageWithEnumUpdate {
	mweu.mutation.SetEnumWithoutDefault(mwd)
	return mweu
}
func (mweu *MessageWithEnumUpdate) Mutation() *MessageWithEnumMutation {
	return mweu.mutation
}
func (mweu *MessageWithEnumUpdate) Save(ctx context.Context) (int, error) {
	var (
		err      error
		affected int
	)
	if len(mweu.hooks) == 0 {
		if err = mweu.check(); err != nil {
			return 0, err
		}
		affected, err = mweu.sqlSave(ctx)
	} else {
		var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
			mutation, ok := m.(*MessageWithEnumMutation)
			if !ok {
				return nil, fmt.Errorf("unexpected mutation type %T", m)
			}
			if err = mweu.check(); err != nil {
				return 0, err
			}
			mweu.mutation = mutation
			affected, err = mweu.sqlSave(ctx)
			mutation.done = true
			return affected, err
		})
		for i := len(mweu.hooks) - 1; i >= 0; i-- {
			if mweu.hooks[i] == nil {
				return 0, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)")
			}
			mut = mweu.hooks[i](mut)
		}
		if _, err := mut.Mutate(ctx, mweu.mutation); err != nil {
			return 0, err
		}
	}
	return affected, err
}
func (mweu *MessageWithEnumUpdate) SaveX(ctx context.Context) int {
	affected, err := mweu.Save(ctx)
	if err != nil {
		panic(err)
	}
	return affected
}
func (mweu *MessageWithEnumUpdate) Exec(ctx context.Context) error {
	_, err := mweu.Save(ctx)
	return err
}
func (mweu *MessageWithEnumUpdate) ExecX(ctx context.Context) {
	if err := mweu.Exec(ctx); err != nil {
		panic(err)
	}
}