func (vmq *ValidMessageQuery) FirstID(ctx context.Context) (id int, err error) {
	var ids []int
	if ids, err = vmq.Limit(1).IDs(ctx); err != nil {
		return
	}
	if len(ids) == 0 {
		err = &NotFoundError{validmessage.Label}
		return
	}
	return ids[0], nil
}
FirstID returns the first ValidMessage ID from the query.
Returns a *NotFoundError when no ValidMessage ID was found.
package ent
import (
	"context"
	"errors"
	"fmt"
	"math"
	"entgo.io/contrib/entproto/internal/entprototest/ent/predicate"
	"entgo.io/contrib/entproto/internal/entprototest/ent/validmessage"
	"entgo.io/ent/dialect/sql"
	"entgo.io/ent/dialect/sql/sqlgraph"
	"entgo.io/ent/schema/field"
)
type ValidMessageQuery struct {
	config
	limit      *int
	offset     *int
	unique     *bool
	order      []OrderFunc
	fields     []string
	predicates []predicate.ValidMessage
	sql  *sql.Selector
	path func(context.Context) (*sql.Selector, error)
}
func (vmq *ValidMessageQuery) Where(ps ...predicate.ValidMessage) *ValidMessageQuery {
	vmq.predicates = append(vmq.predicates, ps...)
	return vmq
}
func (vmq *ValidMessageQuery) Limit(limit int) *ValidMessageQuery {
	vmq.limit = &limit
	return vmq
}
func (vmq *ValidMessageQuery) Offset(offset int) *ValidMessageQuery {
	vmq.offset = &offset
	return vmq
}
func (vmq *ValidMessageQuery) Unique(unique bool) *ValidMessageQuery {
	vmq.unique = &unique
	return vmq
}
func (vmq *ValidMessageQuery) Order(o ...OrderFunc) *ValidMessageQuery {
	vmq.order = append(vmq.order, o...)
	return vmq
}
func (vmq *ValidMessageQuery) First(ctx context.Context) (*ValidMessage, error) {
	nodes, err := vmq.Limit(1).All(ctx)
	if err != nil {
		return nil, err
	}
	if len(nodes) == 0 {
		return nil, &NotFoundError{validmessage.Label}
	}
	return nodes[0], nil
}
func (vmq *ValidMessageQuery) FirstX(ctx context.Context) *ValidMessage {
	node, err := vmq.First(ctx)
	if err != nil && !IsNotFound(err) {
		panic(err)
	}
	return node
}