func (esms *ExplicitSkippedMessageSelect) IntX(ctx context.Context) int {
	v, err := esms.Int(ctx)
	if err != nil {
		panic(err)
	}
	return v
}
IntX is like Int, but panics if an error occurs.
package ent
import (
	"context"
	"errors"
	"fmt"
	"math"
	"entgo.io/contrib/entproto/internal/entprototest/ent/explicitskippedmessage"
	"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 ExplicitSkippedMessageQuery struct {
	config
	limit      *int
	offset     *int
	unique     *bool
	order      []OrderFunc
	fields     []string
	predicates []predicate.ExplicitSkippedMessage
	sql  *sql.Selector
	path func(context.Context) (*sql.Selector, error)
}
func (esmq *ExplicitSkippedMessageQuery) Where(ps ...predicate.ExplicitSkippedMessage) *ExplicitSkippedMessageQuery {
	esmq.predicates = append(esmq.predicates, ps...)
	return esmq
}
func (esmq *ExplicitSkippedMessageQuery) Limit(limit int) *ExplicitSkippedMessageQuery {
	esmq.limit = &limit
	return esmq
}
func (esmq *ExplicitSkippedMessageQuery) Offset(offset int) *ExplicitSkippedMessageQuery {
	esmq.offset = &offset
	return esmq
}
func (esmq *ExplicitSkippedMessageQuery) Unique(unique bool) *ExplicitSkippedMessageQuery {
	esmq.unique = &unique
	return esmq
}
func (esmq *ExplicitSkippedMessageQuery) Order(o ...OrderFunc) *ExplicitSkippedMessageQuery {
	esmq.order = append(esmq.order, o...)
	return esmq
}
func (esmq *ExplicitSkippedMessageQuery) First(ctx context.Context) (*ExplicitSkippedMessage, error) {
	nodes, err := esmq.Limit(1).All(ctx)
	if err != nil {
		return nil, err
	}
	if len(nodes) == 0 {
		return nil, &NotFoundError{explicitskippedmessage.Label}
	}
	return nodes[0], nil
}
func (esmq *ExplicitSkippedMessageQuery) FirstX(ctx context.Context) *ExplicitSkippedMessage {
	node, err := esmq.First(ctx)
	if err != nil && !IsNotFound(err) {
		panic(err)
	}
	return node
}
func (esmq *ExplicitSkippedMessageQuery) FirstID(ctx context.Context) (id int, err error) {
	var ids []int
	if ids, err = esmq.Limit(1).IDs(ctx); err != nil {
		return
	}
	if len(ids) == 0 {
		err = &NotFoundError{explicitskippedmessage.Label}
		return
	}
	return ids[0], nil
}
func (esmq *ExplicitSkippedMessageQuery) FirstIDX(ctx context.Context) int {
	id, err := esmq.FirstID(ctx)
	if err != nil && !IsNotFound(err) {
		panic(err)
	}
	return id
}
func (esmq *ExplicitSkippedMessageQuery) Only(ctx context.Context) (*ExplicitSkippedMessage, error) {
	nodes, err := esmq.Limit(2).All(ctx)
	if err != nil {
		return nil, err
	}
	switch len(nodes) {
	case 1:
		return nodes[0], nil
	case 0:
		return nil, &NotFoundError{explicitskippedmessage.Label}
	default:
		return nil, &NotSingularError{explicitskippedmessage.Label}
	}
}
func (esmq *ExplicitSkippedMessageQuery) OnlyX(ctx context.Context) *ExplicitSkippedMessage {
	node, err := esmq.Only(ctx)
	if err != nil {
		panic(err)
	}
	return node
}
func (esmq *ExplicitSkippedMessageQuery) OnlyID(ctx context.Context) (id int, err error) {
	var ids []int
	if ids, err = esmq.Limit(2).IDs(ctx); err != nil {
		return
	}
	switch len(ids) {
	case 1:
		id = ids[0]
	case 0:
		err = &NotFoundError{explicitskippedmessage.Label}
	default:
		err = &NotSingularError{explicitskippedmessage.Label}
	}
	return
}
func (esmq *ExplicitSkippedMessageQuery) OnlyIDX(ctx context.Context) int {
	id, err := esmq.OnlyID(ctx)
	if err != nil {
		panic(err)
	}
	return id
}
func (esmq *ExplicitSkippedMessageQuery) All(ctx context.Context) ([]*ExplicitSkippedMessage, error) {
	if err := esmq.prepareQuery(ctx); err != nil {
		return nil, err
	}
	return esmq.sqlAll(ctx)
}
func (esmq *ExplicitSkippedMessageQuery) AllX(ctx context.Context) []*ExplicitSkippedMessage {
	nodes, err := esmq.All(ctx)
	if err != nil {
		panic(err)
	}
	return nodes
}
func (esmq *ExplicitSkippedMessageQuery) IDs(ctx context.Context) ([]int, error) {
	var ids []int
	if err := esmq.Select(explicitskippedmessage.FieldID).Scan(ctx, &ids); err != nil {
		return nil, err
	}
	return ids, nil
}
func (esmq *ExplicitSkippedMessageQuery) IDsX(ctx context.Context) []int {
	ids, err := esmq.IDs(ctx)
	if err != nil {
		panic(err)
	}
	return ids
}
func (esmq *ExplicitSkippedMessageQuery) Count(ctx context.Context) (int, error) {
	if err := esmq.prepareQuery(ctx); err != nil {
		return 0, err
	}
	return esmq.sqlCount(ctx)
}
func (esmq *ExplicitSkippedMessageQuery) CountX(ctx context.Context) int {
	count, err := esmq.Count(ctx)
	if err != nil {
		panic(err)
	}
	return count
}
func (esmq *ExplicitSkippedMessageQuery) Exist(ctx context.Context) (bool, error) {
	if err := esmq.prepareQuery(ctx); err != nil {
		return false, err
	}
	return esmq.sqlExist(ctx)
}
func (esmq *ExplicitSkippedMessageQuery) ExistX(ctx context.Context) bool {
	exist, err := esmq.Exist(ctx)
	if err != nil {
		panic(err)
	}
	return exist
}
func (esmq *ExplicitSkippedMessageQuery) Clone() *ExplicitSkippedMessageQuery {
	if esmq == nil {
		return nil
	}
	return &ExplicitSkippedMessageQuery{
		config:     esmq.config,
		limit:      esmq.limit,
		offset:     esmq.offset,
		order:      append([]OrderFunc{}, esmq.order...),
		predicates: append([]predicate.ExplicitSkippedMessage{}, esmq.predicates...),
		sql:  esmq.sql.Clone(),
		path: esmq.path,
	}
}
func (esmq *ExplicitSkippedMessageQuery) GroupBy(field string, fields ...string) *ExplicitSkippedMessageGroupBy {
	group := &ExplicitSkippedMessageGroupBy{config: esmq.config}
	group.fields = append([]string{field}, fields...)
	group.path = func(ctx context.Context) (prev *sql.Selector, err error) {
		if err := esmq.prepareQuery(ctx); err != nil {
			return nil, err
		}
		return esmq.sqlQuery(ctx), nil
	}
	return group
}
func (esmq *ExplicitSkippedMessageQuery) Select(fields ...string) *ExplicitSkippedMessageSelect {
	esmq.fields = append(esmq.fields, fields...)
	return &ExplicitSkippedMessageSelect{ExplicitSkippedMessageQuery: esmq}
}
func (esmq *ExplicitSkippedMessageQuery) prepareQuery(ctx context.Context) error {
	for _, f := range esmq.fields {
		if !explicitskippedmessage.ValidColumn(f) {
			return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
		}
	}
	if esmq.path != nil {
		prev, err := esmq.path(ctx)
		if err != nil {
			return err
		}
		esmq.sql = prev
	}
	return nil
}
func (esmq *ExplicitSkippedMessageQuery) sqlAll(ctx context.Context) ([]*ExplicitSkippedMessage, error) {
	var (
		nodes = []*ExplicitSkippedMessage{}
		_spec = esmq.querySpec()
	)
	_spec.ScanValues = func(columns []string) ([]interface{}, error) {
		node := &ExplicitSkippedMessage{config: esmq.config}
		nodes = append(nodes, node)
		return node.scanValues(columns)
	}
	_spec.Assign = func(columns []string, values []interface{}) error {
		if len(nodes) == 0 {
			return fmt.Errorf("ent: Assign called without calling ScanValues")
		}
		node := nodes[len(nodes)-1]
		return node.assignValues(columns, values)
	}
	if err := sqlgraph.QueryNodes(ctx, esmq.driver, _spec); err != nil {
		return nil, err
	}
	if len(nodes) == 0 {
		return nodes, nil
	}
	return nodes, nil
}
func (esmq *ExplicitSkippedMessageQuery) sqlCount(ctx context.Context) (int, error) {
	_spec := esmq.querySpec()
	return sqlgraph.CountNodes(ctx, esmq.driver, _spec)
}
func (esmq *ExplicitSkippedMessageQuery) sqlExist(ctx context.Context) (bool, error) {
	n, err := esmq.sqlCount(ctx)
	if err != nil {
		return false, fmt.Errorf("ent: check existence: %w", err)
	}
	return n > 0, nil
}
func (esmq *ExplicitSkippedMessageQuery) querySpec() *sqlgraph.QuerySpec {
	_spec := &sqlgraph.QuerySpec{
		Node: &sqlgraph.NodeSpec{
			Table:   explicitskippedmessage.Table,
			Columns: explicitskippedmessage.Columns,
			ID: &sqlgraph.FieldSpec{
				Type:   field.TypeInt,
				Column: explicitskippedmessage.FieldID,
			},
		},
		From:   esmq.sql,
		Unique: true,
	}
	if unique := esmq.unique; unique != nil {
		_spec.Unique = *unique
	}
	if fields := esmq.fields; len(fields) > 0 {
		_spec.Node.Columns = make([]string, 0, len(fields))
		_spec.Node.Columns = append(_spec.Node.Columns, explicitskippedmessage.FieldID)
		for i := range fields {
			if fields[i] != explicitskippedmessage.FieldID {
				_spec.Node.Columns = append(_spec.Node.Columns, fields[i])
			}
		}
	}
	if ps := esmq.predicates; len(ps) > 0 {
		_spec.Predicate = func(selector *sql.Selector) {
			for i := range ps {
				ps[i](selector)
			}
		}
	}
	if limit := esmq.limit; limit != nil {
		_spec.Limit = *limit
	}
	if offset := esmq.offset; offset != nil {
		_spec.Offset = *offset
	}
	if ps := esmq.order; len(ps) > 0 {
		_spec.Order = func(selector *sql.Selector) {
			for i := range ps {
				ps[i](selector)
			}
		}
	}
	return _spec
}
func (esmq *ExplicitSkippedMessageQuery) sqlQuery(ctx context.Context) *sql.Selector {
	builder := sql.Dialect(esmq.driver.Dialect())
	t1 := builder.Table(explicitskippedmessage.Table)
	columns := esmq.fields
	if len(columns) == 0 {
		columns = explicitskippedmessage.Columns
	}
	selector := builder.Select(t1.Columns(columns...)...).From(t1)
	if esmq.sql != nil {
		selector = esmq.sql
		selector.Select(selector.Columns(columns...)...)
	}
	for _, p := range esmq.predicates {
		p(selector)
	}
	for _, p := range esmq.order {
		p(selector)
	}
	if offset := esmq.offset; offset != nil {
		selector.Offset(*offset).Limit(math.MaxInt32)
	}
	if limit := esmq.limit; limit != nil {
		selector.Limit(*limit)
	}
	return selector
}
type ExplicitSkippedMessageGroupBy struct {
	config
	fields []string
	fns    []AggregateFunc
	sql  *sql.Selector
	path func(context.Context) (*sql.Selector, error)
}
func (esmgb *ExplicitSkippedMessageGroupBy) Aggregate(fns ...AggregateFunc) *ExplicitSkippedMessageGroupBy {
	esmgb.fns = append(esmgb.fns, fns...)
	return esmgb
}
func (esmgb *ExplicitSkippedMessageGroupBy) Scan(ctx context.Context, v interface{}) error {
	query, err := esmgb.path(ctx)
	if err != nil {
		return err
	}
	esmgb.sql = query
	return esmgb.sqlScan(ctx, v)
}
func (esmgb *ExplicitSkippedMessageGroupBy) ScanX(ctx context.Context, v interface{}) {
	if err := esmgb.Scan(ctx, v); err != nil {
		panic(err)
	}
}
func (esmgb *ExplicitSkippedMessageGroupBy) Strings(ctx context.Context) ([]string, error) {
	if len(esmgb.fields) > 1 {
		return nil, errors.New("ent: ExplicitSkippedMessageGroupBy.Strings is not achievable when grouping more than 1 field")
	}
	var v []string
	if err := esmgb.Scan(ctx, &v); err != nil {
		return nil, err
	}
	return v, nil
}
func (esmgb *ExplicitSkippedMessageGroupBy) StringsX(ctx context.Context) []string {
	v, err := esmgb.Strings(ctx)
	if err != nil {
		panic(err)
	}
	return v
}
func (esmgb *ExplicitSkippedMessageGroupBy) String(ctx context.Context) (_ string, err error) {
	var v []string
	if v, err = esmgb.Strings(ctx); err != nil {
		return
	}
	switch len(v) {
	case 1:
		return v[0], nil
	case 0:
		err = &NotFoundError{explicitskippedmessage.Label}
	default:
		err = fmt.Errorf("ent: ExplicitSkippedMessageGroupBy.Strings returned %d results when one was expected", len(v))
	}
	return
}
func (esmgb *ExplicitSkippedMessageGroupBy) StringX(ctx context.Context) string {
	v, err := esmgb.String(ctx)
	if err != nil {
		panic(err)
	}
	return v
}
func (esmgb *ExplicitSkippedMessageGroupBy) Ints(ctx context.Context) ([]int, error) {
	if len(esmgb.fields) > 1 {
		return nil, errors.New("ent: ExplicitSkippedMessageGroupBy.Ints is not achievable when grouping more than 1 field")
	}
	var v []int
	if err := esmgb.Scan(ctx, &v); err != nil {
		return nil, err
	}
	return v, nil
}
func (esmgb *ExplicitSkippedMessageGroupBy) IntsX(ctx context.Context) []int {
	v, err := esmgb.Ints(ctx)
	if err != nil {
		panic(err)
	}
	return v
}
func (esmgb *ExplicitSkippedMessageGroupBy) Int(ctx context.Context) (_ int, err error) {
	var v []int
	if v, err = esmgb.Ints(ctx); err != nil {
		return
	}
	switch len(v) {
	case 1:
		return v[0], nil
	case 0:
		err = &NotFoundError{explicitskippedmessage.Label}
	default:
		err = fmt.Errorf("ent: ExplicitSkippedMessageGroupBy.Ints returned %d results when one was expected", len(v))
	}
	return
}
func (esmgb *ExplicitSkippedMessageGroupBy) IntX(ctx context.Context) int {
	v, err := esmgb.Int(ctx)
	if err != nil {
		panic(err)
	}
	return v
}
func (esmgb *ExplicitSkippedMessageGroupBy) Float64s(ctx context.Context) ([]float64, error) {
	if len(esmgb.fields) > 1 {
		return nil, errors.New("ent: ExplicitSkippedMessageGroupBy.Float64s is not achievable when grouping more than 1 field")
	}
	var v []float64
	if err := esmgb.Scan(ctx, &v); err != nil {
		return nil, err
	}
	return v, nil
}
func (esmgb *ExplicitSkippedMessageGroupBy) Float64sX(ctx context.Context) []float64 {
	v, err := esmgb.Float64s(ctx)
	if err != nil {
		panic(err)
	}
	return v
}
func (esmgb *ExplicitSkippedMessageGroupBy) Float64(ctx context.Context) (_ float64, err error) {
	var v []float64
	if v, err = esmgb.Float64s(ctx); err != nil {
		return
	}
	switch len(v) {
	case 1:
		return v[0], nil
	case 0:
		err = &NotFoundError{explicitskippedmessage.Label}
	default:
		err = fmt.Errorf("ent: ExplicitSkippedMessageGroupBy.Float64s returned %d results when one was expected", len(v))
	}
	return
}
func (esmgb *ExplicitSkippedMessageGroupBy) Float64X(ctx context.Context) float64 {
	v, err := esmgb.Float64(ctx)
	if err != nil {
		panic(err)
	}
	return v
}
func (esmgb *ExplicitSkippedMessageGroupBy) Bools(ctx context.Context) ([]bool, error) {
	if len(esmgb.fields) > 1 {
		return nil, errors.New("ent: ExplicitSkippedMessageGroupBy.Bools is not achievable when grouping more than 1 field")
	}
	var v []bool
	if err := esmgb.Scan(ctx, &v); err != nil {
		return nil, err
	}
	return v, nil
}
func (esmgb *ExplicitSkippedMessageGroupBy) BoolsX(ctx context.Context) []bool {
	v, err := esmgb.Bools(ctx)
	if err != nil {
		panic(err)
	}
	return v
}
func (esmgb *ExplicitSkippedMessageGroupBy) Bool(ctx context.Context) (_ bool, err error) {
	var v []bool
	if v, err = esmgb.Bools(ctx); err != nil {
		return
	}
	switch len(v) {
	case 1:
		return v[0], nil
	case 0:
		err = &NotFoundError{explicitskippedmessage.Label}
	default:
		err = fmt.Errorf("ent: ExplicitSkippedMessageGroupBy.Bools returned %d results when one was expected", len(v))
	}
	return
}
func (esmgb *ExplicitSkippedMessageGroupBy) BoolX(ctx context.Context) bool {
	v, err := esmgb.Bool(ctx)
	if err != nil {
		panic(err)
	}
	return v
}
func (esmgb *ExplicitSkippedMessageGroupBy) sqlScan(ctx context.Context, v interface{}) error {
	for _, f := range esmgb.fields {
		if !explicitskippedmessage.ValidColumn(f) {
			return &ValidationError{Name: f, err: fmt.Errorf("invalid field %q for group-by", f)}
		}
	}
	selector := esmgb.sqlQuery()
	if err := selector.Err(); err != nil {
		return err
	}
	rows := &sql.Rows{}
	query, args := selector.Query()
	if err := esmgb.driver.Query(ctx, query, args, rows); err != nil {
		return err
	}
	defer rows.Close()
	return sql.ScanSlice(rows, v)
}
func (esmgb *ExplicitSkippedMessageGroupBy) sqlQuery() *sql.Selector {
	selector := esmgb.sql.Select()
	aggregation := make([]string, 0, len(esmgb.fns))
	for _, fn := range esmgb.fns {
		aggregation = append(aggregation, fn(selector))
	}
	if len(selector.SelectedColumns()) == 0 {
		columns := make([]string, 0, len(esmgb.fields)+len(esmgb.fns))
		for _, f := range esmgb.fields {
			columns = append(columns, selector.C(f))
		}
		for _, c := range aggregation {
			columns = append(columns, c)
		}
		selector.Select(columns...)
	}
	return selector.GroupBy(selector.Columns(esmgb.fields...)...)
}
type ExplicitSkippedMessageSelect struct {
	*ExplicitSkippedMessageQuery
	sql *sql.Selector
}
func (esms *ExplicitSkippedMessageSelect) Scan(ctx context.Context, v interface{}) error {
	if err := esms.prepareQuery(ctx); err != nil {
		return err
	}
	esms.sql = esms.ExplicitSkippedMessageQuery.sqlQuery(ctx)
	return esms.sqlScan(ctx, v)
}
func (esms *ExplicitSkippedMessageSelect) ScanX(ctx context.Context, v interface{}) {
	if err := esms.Scan(ctx, v); err != nil {
		panic(err)
	}
}
func (esms *ExplicitSkippedMessageSelect) Strings(ctx context.Context) ([]string, error) {
	if len(esms.fields) > 1 {
		return nil, errors.New("ent: ExplicitSkippedMessageSelect.Strings is not achievable when selecting more than 1 field")
	}
	var v []string
	if err := esms.Scan(ctx, &v); err != nil {
		return nil, err
	}
	return v, nil
}
func (esms *ExplicitSkippedMessageSelect) StringsX(ctx context.Context) []string {
	v, err := esms.Strings(ctx)
	if err != nil {
		panic(err)
	}
	return v
}
func (esms *ExplicitSkippedMessageSelect) String(ctx context.Context) (_ string, err error) {
	var v []string
	if v, err = esms.Strings(ctx); err != nil {
		return
	}
	switch len(v) {
	case 1:
		return v[0], nil
	case 0:
		err = &NotFoundError{explicitskippedmessage.Label}
	default:
		err = fmt.Errorf("ent: ExplicitSkippedMessageSelect.Strings returned %d results when one was expected", len(v))
	}
	return
}
func (esms *ExplicitSkippedMessageSelect) StringX(ctx context.Context) string {
	v, err := esms.String(ctx)
	if err != nil {
		panic(err)
	}
	return v
}
func (esms *ExplicitSkippedMessageSelect) Ints(ctx context.Context) ([]int, error) {
	if len(esms.fields) > 1 {
		return nil, errors.New("ent: ExplicitSkippedMessageSelect.Ints is not achievable when selecting more than 1 field")
	}
	var v []int
	if err := esms.Scan(ctx, &v); err != nil {
		return nil, err
	}
	return v, nil
}
func (esms *ExplicitSkippedMessageSelect) IntsX(ctx context.Context) []int {
	v, err := esms.Ints(ctx)
	if err != nil {
		panic(err)
	}
	return v
}
func (esms *ExplicitSkippedMessageSelect) Int(ctx context.Context) (_ int, err error) {
	var v []int
	if v, err = esms.Ints(ctx); err != nil {
		return
	}
	switch len(v) {
	case 1:
		return v[0], nil
	case 0:
		err = &NotFoundError{explicitskippedmessage.Label}
	default:
		err = fmt.Errorf("ent: ExplicitSkippedMessageSelect.Ints returned %d results when one was expected", len(v))
	}
	return
}