func (nec *NilExampleCreate) SaveX(ctx context.Context) *NilExample {
	v, err := nec.Save(ctx)
	if err != nil {
		panic(err)
	}
	return v
}
SaveX calls Save and panics if Save returns an error.
package ent
import (
	"context"
	"fmt"
	"time"
	"entgo.io/contrib/entproto/internal/todo/ent/nilexample"
	"entgo.io/ent/dialect/sql/sqlgraph"
	"entgo.io/ent/schema/field"
)
type NilExampleCreate struct {
	config
	mutation *NilExampleMutation
	hooks    []Hook
}
func (nec *NilExampleCreate) SetStrNil(s string) *NilExampleCreate {
	nec.mutation.SetStrNil(s)
	return nec
}
func (nec *NilExampleCreate) SetNillableStrNil(s *string) *NilExampleCreate {
	if s != nil {
		nec.SetStrNil(*s)
	}
	return nec
}
func (nec *NilExampleCreate) SetTimeNil(t time.Time) *NilExampleCreate {
	nec.mutation.SetTimeNil(t)
	return nec
}
func (nec *NilExampleCreate) SetNillableTimeNil(t *time.Time) *NilExampleCreate {
	if t != nil {
		nec.SetTimeNil(*t)
	}
	return nec
}
func (nec *NilExampleCreate) Mutation() *NilExampleMutation {
	return nec.mutation
}
func (nec *NilExampleCreate) Save(ctx context.Context) (*NilExample, error) {
	var (
		err  error
		node *NilExample
	)
	if len(nec.hooks) == 0 {
		if err = nec.check(); err != nil {
			return nil, err
		}
		node, err = nec.sqlSave(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)
			}
			if err = nec.check(); err != nil {
				return nil, err
			}
			nec.mutation = mutation
			if node, err = nec.sqlSave(ctx); err != nil {
				return nil, err
			}
			mutation.id = &node.ID
			mutation.done = true
			return node, err
		})
		for i := len(nec.hooks) - 1; i >= 0; i-- {
			if nec.hooks[i] == nil {
				return nil, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)")
			}
			mut = nec.hooks[i](mut)
		}
		if _, err := mut.Mutate(ctx, nec.mutation); err != nil {
			return nil, err
		}
	}
	return node, err
}