func (cq *CategoryQuery) FirstID(ctx context.Context) (id uuid.UUID, err error) {
	var ids []uuid.UUID
	if ids, err = cq.Limit(1).IDs(ctx); err != nil {
		return
	}
	if len(ids) == 0 {
		err = &NotFoundError{category.Label}
		return
	}
	return ids[0], nil
}
FirstID returns the first Category ID from the query.
Returns a *NotFoundError when no Category ID was found.
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/ent/dialect/sql"
	"entgo.io/ent/dialect/sql/sqlgraph"
	"entgo.io/ent/schema/field"
	"github.com/google/uuid"
)
type CategoryQuery struct {
	config
	limit      *int
	offset     *int
	unique     *bool
	order      []OrderFunc
	fields     []string
	predicates []predicate.Category
	withTodos *TodoQuery
	sql  *sql.Selector
	path func(context.Context) (*sql.Selector, error)
}
func (cq *CategoryQuery) Where(ps ...predicate.Category) *CategoryQuery {
	cq.predicates = append(cq.predicates, ps...)
	return cq
}
func (cq *CategoryQuery) Limit(limit int) *CategoryQuery {
	cq.limit = &limit
	return cq
}
func (cq *CategoryQuery) Offset(offset int) *CategoryQuery {
	cq.offset = &offset
	return cq
}
func (cq *CategoryQuery) Unique(unique bool) *CategoryQuery {
	cq.unique = &unique
	return cq
}
func (cq *CategoryQuery) Order(o ...OrderFunc) *CategoryQuery {
	cq.order = append(cq.order, o...)
	return cq
}
func (cq *CategoryQuery) QueryTodos() *TodoQuery {
	query := &TodoQuery{config: cq.config}
	query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
		if err := cq.prepareQuery(ctx); err != nil {
			return nil, err
		}
		selector := cq.sqlQuery(ctx)
		if err := selector.Err(); err != nil {
			return nil, err
		}
		step := sqlgraph.NewStep(
			sqlgraph.From(category.Table, category.FieldID, selector),
			sqlgraph.To(todo.Table, todo.FieldID),
			sqlgraph.Edge(sqlgraph.O2M, false, category.TodosTable, category.TodosColumn),
		)
		fromU = sqlgraph.SetNeighbors(cq.driver.Dialect(), step)
		return fromU, nil
	}
	return query
}
func (cq *CategoryQuery) First(ctx context.Context) (*Category, error) {
	nodes, err := cq.Limit(1).All(ctx)
	if err != nil {
		return nil, err
	}
	if len(nodes) == 0 {
		return nil, &NotFoundError{category.Label}
	}
	return nodes[0], nil
}
func (cq *CategoryQuery) FirstX(ctx context.Context) *Category {
	node, err := cq.First(ctx)
	if err != nil && !IsNotFound(err) {
		panic(err)
	}
	return node
}