func (ned *NilExampleDelete) Exec(ctx context.Context) (int, error) {
	var (
		err      error
		affected int
	)
	if len(ned.hooks) == 0 {
		affected, err = ned.sqlExec(ctx)
	} else {
		var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
			mutation, ok := m.(*NilExampleMutation)
			if !ok {
				return nil, fmt.Errorf("unexpected mutation type %T", m)
			}
			ned.mutation = mutation
			affected, err = ned.sqlExec(ctx)
			mutation.done = true
			return affected, err
		})
		for i := len(ned.hooks) - 1; i >= 0; i-- {
			if ned.hooks[i] == nil {
				return 0, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)")
			}
			mut = ned.hooks[i](mut)
		}
		if _, err := mut.Mutate(ctx, ned.mutation); err != nil {
			return 0, err
		}
	}
	return affected, err
}
Exec executes the deletion query and returns how many vertices were deleted.
package ent
import (
	"context"
	"fmt"
	"entgo.io/contrib/entproto/internal/todo/ent/nilexample"
	"entgo.io/contrib/entproto/internal/todo/ent/predicate"
	"entgo.io/ent/dialect/sql"
	"entgo.io/ent/dialect/sql/sqlgraph"
	"entgo.io/ent/schema/field"
)
type NilExampleDelete struct {
	config
	hooks    []Hook
	mutation *NilExampleMutation
}
func (ned *NilExampleDelete) Where(ps ...predicate.NilExample) *NilExampleDelete {
	ned.mutation.Where(ps...)
	return ned
}