func (ifmq *InvalidFieldMessageQuery) GroupBy(field string, fields ...string) *InvalidFieldMessageGroupBy {
	group := &InvalidFieldMessageGroupBy{config: ifmq.config}
	group.fields = append([]string{field}, fields...)
	group.path = func(ctx context.Context) (prev *sql.Selector, err error) {
		if err := ifmq.prepareQuery(ctx); err != nil {
			return nil, err
		}
		return ifmq.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 {
JSON *schema.SomeJSON `json:"json,omitempty"`
Count int `json:"count,omitempty"`
}

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