func (mwoq *MessageWithOptionalsQuery) FirstX(ctx context.Context) *MessageWithOptionals {
	node, err := mwoq.First(ctx)
	if err != nil && !IsNotFound(err) {
		panic(err)
	}
	return node
}
FirstX is like First, but panics if an error occurs.
package ent
import (
	"context"
	"errors"
	"fmt"
	"math"
	"entgo.io/contrib/entproto/internal/entprototest/ent/messagewithoptionals"
	"entgo.io/contrib/entproto/internal/entprototest/ent/predicate"
	"entgo.io/ent/dialect/sql"
	"entgo.io/ent/dialect/sql/sqlgraph"
	"entgo.io/ent/schema/field"
)
type MessageWithOptionalsQuery struct {
	config
	limit      *int
	offset     *int
	unique     *bool
	order      []OrderFunc
	fields     []string
	predicates []predicate.MessageWithOptionals
	sql  *sql.Selector
	path func(context.Context) (*sql.Selector, error)
}
func (mwoq *MessageWithOptionalsQuery) Where(ps ...predicate.MessageWithOptionals) *MessageWithOptionalsQuery {
	mwoq.predicates = append(mwoq.predicates, ps...)
	return mwoq
}
func (mwoq *MessageWithOptionalsQuery) Limit(limit int) *MessageWithOptionalsQuery {
	mwoq.limit = &limit
	return mwoq
}
func (mwoq *MessageWithOptionalsQuery) Offset(offset int) *MessageWithOptionalsQuery {
	mwoq.offset = &offset
	return mwoq
}
func (mwoq *MessageWithOptionalsQuery) Unique(unique bool) *MessageWithOptionalsQuery {
	mwoq.unique = &unique
	return mwoq
}
func (mwoq *MessageWithOptionalsQuery) Order(o ...OrderFunc) *MessageWithOptionalsQuery {
	mwoq.order = append(mwoq.order, o...)
	return mwoq
}
func (mwoq *MessageWithOptionalsQuery) First(ctx context.Context) (*MessageWithOptionals, error) {
	nodes, err := mwoq.Limit(1).All(ctx)
	if err != nil {
		return nil, err
	}
	if len(nodes) == 0 {
		return nil, &NotFoundError{messagewithoptionals.Label}
	}
	return nodes[0], nil
}