func (mwpnq *MessageWithPackageNameQuery) FirstIDX(ctx context.Context) int {
	id, err := mwpnq.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"
	"errors"
	"fmt"
	"math"
	"entgo.io/contrib/entproto/internal/entprototest/ent/messagewithpackagename"
	"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 MessageWithPackageNameQuery struct {
	config
	limit      *int
	offset     *int
	unique     *bool
	order      []OrderFunc
	fields     []string
	predicates []predicate.MessageWithPackageName
	sql  *sql.Selector
	path func(context.Context) (*sql.Selector, error)
}
func (mwpnq *MessageWithPackageNameQuery) Where(ps ...predicate.MessageWithPackageName) *MessageWithPackageNameQuery {
	mwpnq.predicates = append(mwpnq.predicates, ps...)
	return mwpnq
}
func (mwpnq *MessageWithPackageNameQuery) Limit(limit int) *MessageWithPackageNameQuery {
	mwpnq.limit = &limit
	return mwpnq
}
func (mwpnq *MessageWithPackageNameQuery) Offset(offset int) *MessageWithPackageNameQuery {
	mwpnq.offset = &offset
	return mwpnq
}
func (mwpnq *MessageWithPackageNameQuery) Unique(unique bool) *MessageWithPackageNameQuery {
	mwpnq.unique = &unique
	return mwpnq
}
func (mwpnq *MessageWithPackageNameQuery) Order(o ...OrderFunc) *MessageWithPackageNameQuery {
	mwpnq.order = append(mwpnq.order, o...)
	return mwpnq
}
func (mwpnq *MessageWithPackageNameQuery) First(ctx context.Context) (*MessageWithPackageName, error) {
	nodes, err := mwpnq.Limit(1).All(ctx)
	if err != nil {
		return nil, err
	}
	if len(nodes) == 0 {
		return nil, &NotFoundError{messagewithpackagename.Label}
	}
	return nodes[0], nil
}
func (mwpnq *MessageWithPackageNameQuery) FirstX(ctx context.Context) *MessageWithPackageName {
	node, err := mwpnq.First(ctx)
	if err != nil && !IsNotFound(err) {
		panic(err)
	}
	return node
}
func (mwpnq *MessageWithPackageNameQuery) FirstID(ctx context.Context) (id int, err error) {
	var ids []int
	if ids, err = mwpnq.Limit(1).IDs(ctx); err != nil {
		return
	}
	if len(ids) == 0 {
		err = &NotFoundError{messagewithpackagename.Label}
		return
	}
	return ids[0], nil
}