func (dosgb *DependsOnSkippedGroupBy) ScanX(ctx context.Context, v interface{}) {
	if err := dosgb.Scan(ctx, v); err != nil {
		panic(err)
	}
}
ScanX is like Scan, but panics if an error occurs.
package ent
import (
	"context"
	"database/sql/driver"
	"errors"
	"fmt"
	"math"
	"entgo.io/contrib/entproto/internal/entprototest/ent/dependsonskipped"
	"entgo.io/contrib/entproto/internal/entprototest/ent/implicitskippedmessage"
	"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 DependsOnSkippedQuery struct {
	config
	limit      *int
	offset     *int
	unique     *bool
	order      []OrderFunc
	fields     []string
	predicates []predicate.DependsOnSkipped
	withSkipped *ImplicitSkippedMessageQuery
	sql  *sql.Selector
	path func(context.Context) (*sql.Selector, error)
}
func (dosq *DependsOnSkippedQuery) Where(ps ...predicate.DependsOnSkipped) *DependsOnSkippedQuery {
	dosq.predicates = append(dosq.predicates, ps...)
	return dosq
}
func (dosq *DependsOnSkippedQuery) Limit(limit int) *DependsOnSkippedQuery {
	dosq.limit = &limit
	return dosq
}
func (dosq *DependsOnSkippedQuery) Offset(offset int) *DependsOnSkippedQuery {
	dosq.offset = &offset
	return dosq
}
func (dosq *DependsOnSkippedQuery) Unique(unique bool) *DependsOnSkippedQuery {
	dosq.unique = &unique
	return dosq
}
func (dosq *DependsOnSkippedQuery) Order(o ...OrderFunc) *DependsOnSkippedQuery {
	dosq.order = append(dosq.order, o...)
	return dosq
}
func (dosq *DependsOnSkippedQuery) QuerySkipped() *ImplicitSkippedMessageQuery {
	query := &ImplicitSkippedMessageQuery{config: dosq.config}
	query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
		if err := dosq.prepareQuery(ctx); err != nil {
			return nil, err
		}
		selector := dosq.sqlQuery(ctx)
		if err := selector.Err(); err != nil {
			return nil, err
		}
		step := sqlgraph.NewStep(
			sqlgraph.From(dependsonskipped.Table, dependsonskipped.FieldID, selector),
			sqlgraph.To(implicitskippedmessage.Table, implicitskippedmessage.FieldID),
			sqlgraph.Edge(sqlgraph.O2M, false, dependsonskipped.SkippedTable, dependsonskipped.SkippedColumn),
		)
		fromU = sqlgraph.SetNeighbors(dosq.driver.Dialect(), step)
		return fromU, nil
	}
	return query
}
func (dosq *DependsOnSkippedQuery) First(ctx context.Context) (*DependsOnSkipped, error) {
	nodes, err := dosq.Limit(1).All(ctx)
	if err != nil {
		return nil, err
	}
	if len(nodes) == 0 {
		return nil, &NotFoundError{dependsonskipped.Label}
	}
	return nodes[0], nil
}
func (dosq *DependsOnSkippedQuery) FirstX(ctx context.Context) *DependsOnSkipped {
	node, err := dosq.First(ctx)
	if err != nil && !IsNotFound(err) {
		panic(err)
	}
	return node
}
func (dosq *DependsOnSkippedQuery) FirstID(ctx context.Context) (id int, err error) {
	var ids []int
	if ids, err = dosq.Limit(1).IDs(ctx); err != nil {
		return
	}
	if len(ids) == 0 {
		err = &NotFoundError{dependsonskipped.Label}
		return
	}
	return ids[0], nil
}
func (dosq *DependsOnSkippedQuery) FirstIDX(ctx context.Context) int {
	id, err := dosq.FirstID(ctx)
	if err != nil && !IsNotFound(err) {
		panic(err)
	}
	return id
}
func (dosq *DependsOnSkippedQuery) Only(ctx context.Context) (*DependsOnSkipped, error) {
	nodes, err := dosq.Limit(2).All(ctx)
	if err != nil {
		return nil, err
	}
	switch len(nodes) {
	case 1:
		return nodes[0], nil
	case 0:
		return nil, &NotFoundError{dependsonskipped.Label}
	default:
		return nil, &NotSingularError{dependsonskipped.Label}
	}
}
func (dosq *DependsOnSkippedQuery) OnlyX(ctx context.Context) *DependsOnSkipped {
	node, err := dosq.Only(ctx)
	if err != nil {
		panic(err)
	}
	return node
}
func (dosq *DependsOnSkippedQuery) OnlyID(ctx context.Context) (id int, err error) {
	var ids []int
	if ids, err = dosq.Limit(2).IDs(ctx); err != nil {
		return
	}
	switch len(ids) {
	case 1:
		id = ids[0]
	case 0:
		err = &NotFoundError{dependsonskipped.Label}
	default:
		err = &NotSingularError{dependsonskipped.Label}
	}
	return
}
func (dosq *DependsOnSkippedQuery) OnlyIDX(ctx context.Context) int {
	id, err := dosq.OnlyID(ctx)
	if err != nil {
		panic(err)
	}
	return id
}
func (dosq *DependsOnSkippedQuery) All(ctx context.Context) ([]*DependsOnSkipped, error) {
	if err := dosq.prepareQuery(ctx); err != nil {
		return nil, err
	}
	return dosq.sqlAll(ctx)
}
func (dosq *DependsOnSkippedQuery) AllX(ctx context.Context) []*DependsOnSkipped {
	nodes, err := dosq.All(ctx)
	if err != nil {
		panic(err)
	}
	return nodes
}
func (dosq *DependsOnSkippedQuery) IDs(ctx context.Context) ([]int, error) {
	var ids []int
	if err := dosq.Select(dependsonskipped.FieldID).Scan(ctx, &ids); err != nil {
		return nil, err
	}
	return ids, nil
}
func (dosq *DependsOnSkippedQuery) IDsX(ctx context.Context) []int {
	ids, err := dosq.IDs(ctx)
	if err != nil {
		panic(err)
	}
	return ids
}
func (dosq *DependsOnSkippedQuery) Count(ctx context.Context) (int, error) {
	if err := dosq.prepareQuery(ctx); err != nil {
		return 0, err
	}
	return dosq.sqlCount(ctx)
}
func (dosq *DependsOnSkippedQuery) CountX(ctx context.Context) int {
	count, err := dosq.Count(ctx)
	if err != nil {
		panic(err)
	}
	return count
}
func (dosq *DependsOnSkippedQuery) Exist(ctx context.Context) (bool, error) {
	if err := dosq.prepareQuery(ctx); err != nil {
		return false, err
	}
	return dosq.sqlExist(ctx)
}
func (dosq *DependsOnSkippedQuery) ExistX(ctx context.Context) bool {
	exist, err := dosq.Exist(ctx)
	if err != nil {
		panic(err)
	}
	return exist
}
func (dosq *DependsOnSkippedQuery) Clone() *DependsOnSkippedQuery {
	if dosq == nil {
		return nil
	}
	return &DependsOnSkippedQuery{
		config:      dosq.config,
		limit:       dosq.limit,
		offset:      dosq.offset,
		order:       append([]OrderFunc{}, dosq.order...),
		predicates:  append([]predicate.DependsOnSkipped{}, dosq.predicates...),
		withSkipped: dosq.withSkipped.Clone(),
		sql:  dosq.sql.Clone(),
		path: dosq.path,
	}
}
func (dosq *DependsOnSkippedQuery) WithSkipped(opts ...func(*ImplicitSkippedMessageQuery)) *DependsOnSkippedQuery {
	query := &ImplicitSkippedMessageQuery{config: dosq.config}
	for _, opt := range opts {
		opt(query)
	}
	dosq.withSkipped = query
	return dosq
}
func (dosq *DependsOnSkippedQuery) GroupBy(field string, fields ...string) *DependsOnSkippedGroupBy {
	group := &DependsOnSkippedGroupBy{config: dosq.config}
	group.fields = append([]string{field}, fields...)
	group.path = func(ctx context.Context) (prev *sql.Selector, err error) {
		if err := dosq.prepareQuery(ctx); err != nil {
			return nil, err
		}
		return dosq.sqlQuery(ctx), nil
	}
	return group
}
func (dosq *DependsOnSkippedQuery) Select(fields ...string) *DependsOnSkippedSelect {
	dosq.fields = append(dosq.fields, fields...)
	return &DependsOnSkippedSelect{DependsOnSkippedQuery: dosq}
}
func (dosq *DependsOnSkippedQuery) prepareQuery(ctx context.Context) error {
	for _, f := range dosq.fields {
		if !dependsonskipped.ValidColumn(f) {
			return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
		}
	}
	if dosq.path != nil {
		prev, err := dosq.path(ctx)
		if err != nil {
			return err
		}
		dosq.sql = prev
	}
	return nil
}
func (dosq *DependsOnSkippedQuery) sqlAll(ctx context.Context) ([]*DependsOnSkipped, error) {
	var (
		nodes       = []*DependsOnSkipped{}
		_spec       = dosq.querySpec()
		loadedTypes = [1]bool{
			dosq.withSkipped != nil,
		}
	)
	_spec.ScanValues = func(columns []string) ([]interface{}, error) {
		node := &DependsOnSkipped{config: dosq.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]
		node.Edges.loadedTypes = loadedTypes
		return node.assignValues(columns, values)
	}
	if err := sqlgraph.QueryNodes(ctx, dosq.driver, _spec); err != nil {
		return nil, err
	}
	if len(nodes) == 0 {
		return nodes, nil
	}
	if query := dosq.withSkipped; query != nil {
		fks := make([]driver.Value, 0, len(nodes))
		nodeids := make(map[int]*DependsOnSkipped)
		for i := range nodes {
			fks = append(fks, nodes[i].ID)
			nodeids[nodes[i].ID] = nodes[i]
			nodes[i].Edges.Skipped = []*ImplicitSkippedMessage{}
		}
		query.withFKs = true
		query.Where(predicate.ImplicitSkippedMessage(func(s *sql.Selector) {
			s.Where(sql.InValues(dependsonskipped.SkippedColumn, fks...))
		}))
		neighbors, err := query.All(ctx)
		if err != nil {
			return nil, err
		}
		for _, n := range neighbors {
			fk := n.depends_on_skipped_skipped
			if fk == nil {
				return nil, fmt.Errorf(`foreign-key "depends_on_skipped_skipped" is nil for node %v`, n.ID)
			}
			node, ok := nodeids[*fk]
			if !ok {
				return nil, fmt.Errorf(`unexpected foreign-key "depends_on_skipped_skipped" returned %v for node %v`, *fk, n.ID)
			}
			node.Edges.Skipped = append(node.Edges.Skipped, n)
		}
	}
	return nodes, nil
}
func (dosq *DependsOnSkippedQuery) sqlCount(ctx context.Context) (int, error) {
	_spec := dosq.querySpec()
	return sqlgraph.CountNodes(ctx, dosq.driver, _spec)
}
func (dosq *DependsOnSkippedQuery) sqlExist(ctx context.Context) (bool, error) {
	n, err := dosq.sqlCount(ctx)
	if err != nil {
		return false, fmt.Errorf("ent: check existence: %w", err)
	}
	return n > 0, nil
}
func (dosq *DependsOnSkippedQuery) querySpec() *sqlgraph.QuerySpec {
	_spec := &sqlgraph.QuerySpec{
		Node: &sqlgraph.NodeSpec{
			Table:   dependsonskipped.Table,
			Columns: dependsonskipped.Columns,
			ID: &sqlgraph.FieldSpec{
				Type:   field.TypeInt,
				Column: dependsonskipped.FieldID,
			},
		},
		From:   dosq.sql,
		Unique: true,
	}
	if unique := dosq.unique; unique != nil {
		_spec.Unique = *unique
	}
	if fields := dosq.fields; len(fields) > 0 {
		_spec.Node.Columns = make([]string, 0, len(fields))
		_spec.Node.Columns = append(_spec.Node.Columns, dependsonskipped.FieldID)
		for i := range fields {
			if fields[i] != dependsonskipped.FieldID {
				_spec.Node.Columns = append(_spec.Node.Columns, fields[i])
			}
		}
	}
	if ps := dosq.predicates; len(ps) > 0 {
		_spec.Predicate = func(selector *sql.Selector) {
			for i := range ps {
				ps[i](selector)
			}
		}
	}
	if limit := dosq.limit; limit != nil {
		_spec.Limit = *limit
	}
	if offset := dosq.offset; offset != nil {
		_spec.Offset = *offset
	}
	if ps := dosq.order; len(ps) > 0 {
		_spec.Order = func(selector *sql.Selector) {
			for i := range ps {
				ps[i](selector)
			}
		}
	}
	return _spec
}
func (dosq *DependsOnSkippedQuery) sqlQuery(ctx context.Context) *sql.Selector {
	builder := sql.Dialect(dosq.driver.Dialect())
	t1 := builder.Table(dependsonskipped.Table)
	columns := dosq.fields
	if len(columns) == 0 {
		columns = dependsonskipped.Columns
	}
	selector := builder.Select(t1.Columns(columns...)...).From(t1)
	if dosq.sql != nil {
		selector = dosq.sql
		selector.Select(selector.Columns(columns...)...)
	}
	for _, p := range dosq.predicates {
		p(selector)
	}
	for _, p := range dosq.order {
		p(selector)
	}
	if offset := dosq.offset; offset != nil {
		selector.Offset(*offset).Limit(math.MaxInt32)
	}
	if limit := dosq.limit; limit != nil {
		selector.Limit(*limit)
	}
	return selector
}
type DependsOnSkippedGroupBy struct {
	config
	fields []string
	fns    []AggregateFunc
	sql  *sql.Selector
	path func(context.Context) (*sql.Selector, error)
}
func (dosgb *DependsOnSkippedGroupBy) Aggregate(fns ...AggregateFunc) *DependsOnSkippedGroupBy {
	dosgb.fns = append(dosgb.fns, fns...)
	return dosgb
}
func (dosgb *DependsOnSkippedGroupBy) Scan(ctx context.Context, v interface{}) error {
	query, err := dosgb.path(ctx)
	if err != nil {
		return err
	}
	dosgb.sql = query
	return dosgb.sqlScan(ctx, v)
}