func (cc *CategoryCreate) ExecX(ctx context.Context) {
	if err := cc.Exec(ctx); err != nil {
		panic(err)
	}
}
ExecX is like Exec, but panics if an error occurs.
package ent
import (
	"context"
	"errors"
	"fmt"
	"time"
	"entgo.io/contrib/entgql/internal/todo/ent/category"
	"entgo.io/contrib/entgql/internal/todo/ent/schema/schematype"
	"entgo.io/contrib/entgql/internal/todo/ent/todo"
	"entgo.io/ent/dialect/sql/sqlgraph"
	"entgo.io/ent/schema/field"
)
type CategoryCreate struct {
	config
	mutation *CategoryMutation
	hooks    []Hook
}
func (cc *CategoryCreate) SetText(s string) *CategoryCreate {
	cc.mutation.SetText(s)
	return cc
}
func (cc *CategoryCreate) SetStatus(c category.Status) *CategoryCreate {
	cc.mutation.SetStatus(c)
	return cc
}
func (cc *CategoryCreate) SetConfig(sc *schematype.CategoryConfig) *CategoryCreate {
	cc.mutation.SetConfig(sc)
	return cc
}
func (cc *CategoryCreate) SetDuration(t time.Duration) *CategoryCreate {
	cc.mutation.SetDuration(t)
	return cc
}
func (cc *CategoryCreate) SetNillableDuration(t *time.Duration) *CategoryCreate {
	if t != nil {
		cc.SetDuration(*t)
	}
	return cc
}
func (cc *CategoryCreate) SetCount(u uint64) *CategoryCreate {
	cc.mutation.SetCount(u)
	return cc
}
func (cc *CategoryCreate) SetNillableCount(u *uint64) *CategoryCreate {
	if u != nil {
		cc.SetCount(*u)
	}
	return cc
}
func (cc *CategoryCreate) AddTodoIDs(ids ...int) *CategoryCreate {
	cc.mutation.AddTodoIDs(ids...)
	return cc
}
func (cc *CategoryCreate) AddTodos(t ...*Todo) *CategoryCreate {
	ids := make([]int, len(t))
	for i := range t {
		ids[i] = t[i].ID
	}
	return cc.AddTodoIDs(ids...)
}
func (cc *CategoryCreate) Mutation() *CategoryMutation {
	return cc.mutation
}
func (cc *CategoryCreate) Save(ctx context.Context) (*Category, error) {
	var (
		err  error
		node *Category
	)
	if len(cc.hooks) == 0 {
		if err = cc.check(); err != nil {
			return nil, err
		}
		node, err = cc.sqlSave(ctx)
	} else {
		var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
			mutation, ok := m.(*CategoryMutation)
			if !ok {
				return nil, fmt.Errorf("unexpected mutation type %T", m)
			}
			if err = cc.check(); err != nil {
				return nil, err
			}
			cc.mutation = mutation
			if node, err = cc.sqlSave(ctx); err != nil {
				return nil, err
			}
			mutation.id = &node.ID
			mutation.done = true
			return node, err
		})
		for i := len(cc.hooks) - 1; i >= 0; i-- {
			if cc.hooks[i] == nil {
				return nil, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)")
			}
			mut = cc.hooks[i](mut)
		}
		if _, err := mut.Mutate(ctx, cc.mutation); err != nil {
			return nil, err
		}
	}
	return node, err
}
func (cc *CategoryCreate) SaveX(ctx context.Context) *Category {
	v, err := cc.Save(ctx)
	if err != nil {
		panic(err)
	}
	return v
}
func (cc *CategoryCreate) Exec(ctx context.Context) error {
	_, err := cc.Save(ctx)
	return err
}