func (tq *TodoQuery) FirstIDX(ctx context.Context) uuid.UUID {
	id, err := tq.FirstID(ctx)
	if err != nil && !IsNotFound(err) {
		panic(err)
	}
	return id
}
FirstIDX is like FirstID, but panics if an error occurs.
package ent
import (
	"context"
	"database/sql/driver"
	"errors"
	"fmt"
	"math"
	"entgo.io/contrib/entgql/internal/todouuid/ent/category"
	"entgo.io/contrib/entgql/internal/todouuid/ent/predicate"
	"entgo.io/contrib/entgql/internal/todouuid/ent/todo"
	"entgo.io/contrib/entgql/internal/todouuid/ent/verysecret"
	"entgo.io/ent/dialect/sql"
	"entgo.io/ent/dialect/sql/sqlgraph"
	"entgo.io/ent/schema/field"
	"github.com/google/uuid"
)
type TodoQuery struct {
	config
	limit      *int
	offset     *int
	unique     *bool
	order      []OrderFunc
	fields     []string
	predicates []predicate.Todo
	withParent   *TodoQuery
	withChildren *TodoQuery
	withCategory *CategoryQuery
	withSecret   *VerySecretQuery
	withFKs      bool
	sql  *sql.Selector
	path func(context.Context) (*sql.Selector, error)
}
func (tq *TodoQuery) Where(ps ...predicate.Todo) *TodoQuery {
	tq.predicates = append(tq.predicates, ps...)
	return tq
}
func (tq *TodoQuery) Limit(limit int) *TodoQuery {
	tq.limit = &limit
	return tq
}
func (tq *TodoQuery) Offset(offset int) *TodoQuery {
	tq.offset = &offset
	return tq
}
func (tq *TodoQuery) Unique(unique bool) *TodoQuery {
	tq.unique = &unique
	return tq
}
func (tq *TodoQuery) Order(o ...OrderFunc) *TodoQuery {
	tq.order = append(tq.order, o...)
	return tq
}
func (tq *TodoQuery) QueryParent() *TodoQuery {
	query := &TodoQuery{config: tq.config}
	query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
		if err := tq.prepareQuery(ctx); err != nil {
			return nil, err
		}
		selector := tq.sqlQuery(ctx)
		if err := selector.Err(); err != nil {
			return nil, err
		}
		step := sqlgraph.NewStep(
			sqlgraph.From(todo.Table, todo.FieldID, selector),
			sqlgraph.To(todo.Table, todo.FieldID),
			sqlgraph.Edge(sqlgraph.M2O, true, todo.ParentTable, todo.ParentColumn),
		)
		fromU = sqlgraph.SetNeighbors(tq.driver.Dialect(), step)
		return fromU, nil
	}
	return query
}
func (tq *TodoQuery) QueryChildren() *TodoQuery {
	query := &TodoQuery{config: tq.config}
	query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
		if err := tq.prepareQuery(ctx); err != nil {
			return nil, err
		}
		selector := tq.sqlQuery(ctx)
		if err := selector.Err(); err != nil {
			return nil, err
		}
		step := sqlgraph.NewStep(
			sqlgraph.From(todo.Table, todo.FieldID, selector),
			sqlgraph.To(todo.Table, todo.FieldID),
			sqlgraph.Edge(sqlgraph.O2M, false, todo.ChildrenTable, todo.ChildrenColumn),
		)
		fromU = sqlgraph.SetNeighbors(tq.driver.Dialect(), step)
		return fromU, nil
	}
	return query
}
func (tq *TodoQuery) QueryCategory() *CategoryQuery {
	query := &CategoryQuery{config: tq.config}
	query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
		if err := tq.prepareQuery(ctx); err != nil {
			return nil, err
		}
		selector := tq.sqlQuery(ctx)
		if err := selector.Err(); err != nil {
			return nil, err
		}
		step := sqlgraph.NewStep(
			sqlgraph.From(todo.Table, todo.FieldID, selector),
			sqlgraph.To(category.Table, category.FieldID),
			sqlgraph.Edge(sqlgraph.M2O, true, todo.CategoryTable, todo.CategoryColumn),
		)
		fromU = sqlgraph.SetNeighbors(tq.driver.Dialect(), step)
		return fromU, nil
	}
	return query
}
func (tq *TodoQuery) QuerySecret() *VerySecretQuery {
	query := &VerySecretQuery{config: tq.config}
	query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
		if err := tq.prepareQuery(ctx); err != nil {
			return nil, err
		}
		selector := tq.sqlQuery(ctx)
		if err := selector.Err(); err != nil {
			return nil, err
		}
		step := sqlgraph.NewStep(
			sqlgraph.From(todo.Table, todo.FieldID, selector),
			sqlgraph.To(verysecret.Table, verysecret.FieldID),
			sqlgraph.Edge(sqlgraph.M2O, false, todo.SecretTable, todo.SecretColumn),
		)
		fromU = sqlgraph.SetNeighbors(tq.driver.Dialect(), step)
		return fromU, nil
	}
	return query
}
func (tq *TodoQuery) First(ctx context.Context) (*Todo, error) {
	nodes, err := tq.Limit(1).All(ctx)
	if err != nil {
		return nil, err
	}
	if len(nodes) == 0 {
		return nil, &NotFoundError{todo.Label}
	}
	return nodes[0], nil
}
func (tq *TodoQuery) FirstX(ctx context.Context) *Todo {
	node, err := tq.First(ctx)
	if err != nil && !IsNotFound(err) {
		panic(err)
	}
	return node
}
func (tq *TodoQuery) FirstID(ctx context.Context) (id uuid.UUID, err error) {
	var ids []uuid.UUID
	if ids, err = tq.Limit(1).IDs(ctx); err != nil {
		return
	}
	if len(ids) == 0 {
		err = &NotFoundError{todo.Label}
		return
	}
	return ids[0], nil
}