func (neq *NilExampleQuery) GroupBy(field string, fields ...string) *NilExampleGroupBy {
	group := &NilExampleGroupBy{config: neq.config}
	group.fields = append([]string{field}, fields...)
	group.path = func(ctx context.Context) (prev *sql.Selector, err error) {
		if err := neq.prepareQuery(ctx); err != nil {
			return nil, err
		}
		return neq.sqlQuery(ctx), nil
	}
	return group
}
GroupBy is used to group vertices by one or more fields/columns.
It is often used with aggregate functions, like: count, max, mean, min, sum.

Example:

var v []struct {
StrNil string `json:"str_nil,omitempty"`
Count int `json:"count,omitempty"`
}

client.NilExample.Query().
GroupBy(nilexample.FieldStrNil).
Aggregate(ent.Count()).
Scan(ctx, &v)
package ent
import (
	"context"
	"errors"
	"fmt"
	"math"
	"entgo.io/contrib/entproto/internal/todo/ent/nilexample"
	"entgo.io/contrib/entproto/internal/todo/ent/predicate"
	"entgo.io/ent/dialect/sql"
	"entgo.io/ent/dialect/sql/sqlgraph"
	"entgo.io/ent/schema/field"
)
type NilExampleQuery struct {
	config
	limit      *int
	offset     *int
	unique     *bool
	order      []OrderFunc
	fields     []string
	predicates []predicate.NilExample
	sql  *sql.Selector
	path func(context.Context) (*sql.Selector, error)
}
func (neq *NilExampleQuery) Where(ps ...predicate.NilExample) *NilExampleQuery {
	neq.predicates = append(neq.predicates, ps...)
	return neq
}
func (neq *NilExampleQuery) Limit(limit int) *NilExampleQuery {
	neq.limit = &limit
	return neq
}
func (neq *NilExampleQuery) Offset(offset int) *NilExampleQuery {
	neq.offset = &offset
	return neq
}
func (neq *NilExampleQuery) Unique(unique bool) *NilExampleQuery {
	neq.unique = &unique
	return neq
}
func (neq *NilExampleQuery) Order(o ...OrderFunc) *NilExampleQuery {
	neq.order = append(neq.order, o...)
	return neq
}
func (neq *NilExampleQuery) First(ctx context.Context) (*NilExample, error) {
	nodes, err := neq.Limit(1).All(ctx)
	if err != nil {
		return nil, err
	}
	if len(nodes) == 0 {
		return nil, &NotFoundError{nilexample.Label}
	}
	return nodes[0], nil
}
func (neq *NilExampleQuery) FirstX(ctx context.Context) *NilExample {
	node, err := neq.First(ctx)
	if err != nil && !IsNotFound(err) {
		panic(err)
	}
	return node
}
func (neq *NilExampleQuery) FirstID(ctx context.Context) (id int, err error) {
	var ids []int
	if ids, err = neq.Limit(1).IDs(ctx); err != nil {
		return
	}
	if len(ids) == 0 {
		err = &NotFoundError{nilexample.Label}
		return
	}
	return ids[0], nil
}
func (neq *NilExampleQuery) FirstIDX(ctx context.Context) int {
	id, err := neq.FirstID(ctx)
	if err != nil && !IsNotFound(err) {
		panic(err)
	}
	return id
}
func (neq *NilExampleQuery) Only(ctx context.Context) (*NilExample, error) {
	nodes, err := neq.Limit(2).All(ctx)
	if err != nil {
		return nil, err
	}
	switch len(nodes) {
	case 1:
		return nodes[0], nil
	case 0:
		return nil, &NotFoundError{nilexample.Label}
	default:
		return nil, &NotSingularError{nilexample.Label}
	}
}
func (neq *NilExampleQuery) OnlyX(ctx context.Context) *NilExample {
	node, err := neq.Only(ctx)
	if err != nil {
		panic(err)
	}
	return node
}
func (neq *NilExampleQuery) OnlyID(ctx context.Context) (id int, err error) {
	var ids []int
	if ids, err = neq.Limit(2).IDs(ctx); err != nil {
		return
	}
	switch len(ids) {
	case 1:
		id = ids[0]
	case 0:
		err = &NotFoundError{nilexample.Label}
	default:
		err = &NotSingularError{nilexample.Label}
	}
	return
}
func (neq *NilExampleQuery) OnlyIDX(ctx context.Context) int {
	id, err := neq.OnlyID(ctx)
	if err != nil {
		panic(err)
	}
	return id
}
func (neq *NilExampleQuery) All(ctx context.Context) ([]*NilExample, error) {
	if err := neq.prepareQuery(ctx); err != nil {
		return nil, err
	}
	return neq.sqlAll(ctx)
}
func (neq *NilExampleQuery) AllX(ctx context.Context) []*NilExample {
	nodes, err := neq.All(ctx)
	if err != nil {
		panic(err)
	}
	return nodes
}
func (neq *NilExampleQuery) IDs(ctx context.Context) ([]int, error) {
	var ids []int
	if err := neq.Select(nilexample.FieldID).Scan(ctx, &ids); err != nil {
		return nil, err
	}
	return ids, nil
}
func (neq *NilExampleQuery) IDsX(ctx context.Context) []int {
	ids, err := neq.IDs(ctx)
	if err != nil {
		panic(err)
	}
	return ids
}
func (neq *NilExampleQuery) Count(ctx context.Context) (int, error) {
	if err := neq.prepareQuery(ctx); err != nil {
		return 0, err
	}
	return neq.sqlCount(ctx)
}
func (neq *NilExampleQuery) CountX(ctx context.Context) int {
	count, err := neq.Count(ctx)
	if err != nil {
		panic(err)
	}
	return count
}
func (neq *NilExampleQuery) Exist(ctx context.Context) (bool, error) {
	if err := neq.prepareQuery(ctx); err != nil {
		return false, err
	}
	return neq.sqlExist(ctx)
}
func (neq *NilExampleQuery) ExistX(ctx context.Context) bool {
	exist, err := neq.Exist(ctx)
	if err != nil {
		panic(err)
	}
	return exist
}
func (neq *NilExampleQuery) Clone() *NilExampleQuery {
	if neq == nil {
		return nil
	}
	return &NilExampleQuery{
		config:     neq.config,
		limit:      neq.limit,
		offset:     neq.offset,
		order:      append([]OrderFunc{}, neq.order...),
		predicates: append([]predicate.NilExample{}, neq.predicates...),
		sql:  neq.sql.Clone(),
		path: neq.path,
	}
}