func (aq *AddressQuery) Count(ctx context.Context) (int, error) {
	if err := aq.prepareQuery(ctx); err != nil {
		return 0, err
	}
	return aq.sqlCount(ctx)
}
Count returns the count of the given query.
package ent
import (
	"context"
	"errors"
	"fmt"
	"math"
	"entgo.io/ent/dialect/sql"
	"entgo.io/ent/dialect/sql/sqlgraph"
	"entgo.io/ent/schema/field"
	"github.com/go-kratos/beer-shop/app/user/service/internal/data/ent/address"
	"github.com/go-kratos/beer-shop/app/user/service/internal/data/ent/predicate"
	"github.com/go-kratos/beer-shop/app/user/service/internal/data/ent/user"
)
type AddressQuery struct {
	config
	limit      *int
	offset     *int
	order      []OrderFunc
	fields     []string
	predicates []predicate.Address
	withUser *UserQuery
	withFKs  bool
	sql  *sql.Selector
	path func(context.Context) (*sql.Selector, error)
}
func (aq *AddressQuery) Where(ps ...predicate.Address) *AddressQuery {
	aq.predicates = append(aq.predicates, ps...)
	return aq
}
func (aq *AddressQuery) Limit(limit int) *AddressQuery {
	aq.limit = &limit
	return aq
}
func (aq *AddressQuery) Offset(offset int) *AddressQuery {
	aq.offset = &offset
	return aq
}
func (aq *AddressQuery) Order(o ...OrderFunc) *AddressQuery {
	aq.order = append(aq.order, o...)
	return aq
}
func (aq *AddressQuery) QueryUser() *UserQuery {
	query := &UserQuery{config: aq.config}
	query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
		if err := aq.prepareQuery(ctx); err != nil {
			return nil, err
		}
		selector := aq.sqlQuery(ctx)
		if err := selector.Err(); err != nil {
			return nil, err
		}
		step := sqlgraph.NewStep(
			sqlgraph.From(address.Table, address.FieldID, selector),
			sqlgraph.To(user.Table, user.FieldID),
			sqlgraph.Edge(sqlgraph.M2O, true, address.UserTable, address.UserColumn),
		)
		fromU = sqlgraph.SetNeighbors(aq.driver.Dialect(), step)
		return fromU, nil
	}
	return query
}
func (aq *AddressQuery) First(ctx context.Context) (*Address, error) {
	nodes, err := aq.Limit(1).All(ctx)
	if err != nil {
		return nil, err
	}
	if len(nodes) == 0 {
		return nil, &NotFoundError{address.Label}
	}
	return nodes[0], nil
}
func (aq *AddressQuery) FirstX(ctx context.Context) *Address {
	node, err := aq.First(ctx)
	if err != nil && !IsNotFound(err) {
		panic(err)
	}
	return node
}
func (aq *AddressQuery) FirstID(ctx context.Context) (id int64, err error) {
	var ids []int64
	if ids, err = aq.Limit(1).IDs(ctx); err != nil {
		return
	}
	if len(ids) == 0 {
		err = &NotFoundError{address.Label}
		return
	}
	return ids[0], nil
}
func (aq *AddressQuery) FirstIDX(ctx context.Context) int64 {
	id, err := aq.FirstID(ctx)
	if err != nil && !IsNotFound(err) {
		panic(err)
	}
	return id
}
func (aq *AddressQuery) Only(ctx context.Context) (*Address, error) {
	nodes, err := aq.Limit(2).All(ctx)
	if err != nil {
		return nil, err
	}
	switch len(nodes) {
	case 1:
		return nodes[0], nil
	case 0:
		return nil, &NotFoundError{address.Label}
	default:
		return nil, &NotSingularError{address.Label}
	}
}
func (aq *AddressQuery) OnlyX(ctx context.Context) *Address {
	node, err := aq.Only(ctx)
	if err != nil {
		panic(err)
	}
	return node
}
func (aq *AddressQuery) OnlyID(ctx context.Context) (id int64, err error) {
	var ids []int64
	if ids, err = aq.Limit(2).IDs(ctx); err != nil {
		return
	}
	switch len(ids) {
	case 1:
		id = ids[0]
	case 0:
		err = &NotFoundError{address.Label}
	default:
		err = &NotSingularError{address.Label}
	}
	return
}
func (aq *AddressQuery) OnlyIDX(ctx context.Context) int64 {
	id, err := aq.OnlyID(ctx)
	if err != nil {
		panic(err)
	}
	return id
}
func (aq *AddressQuery) All(ctx context.Context) ([]*Address, error) {
	if err := aq.prepareQuery(ctx); err != nil {
		return nil, err
	}
	return aq.sqlAll(ctx)
}
func (aq *AddressQuery) AllX(ctx context.Context) []*Address {
	nodes, err := aq.All(ctx)
	if err != nil {
		panic(err)
	}
	return nodes
}
func (aq *AddressQuery) IDs(ctx context.Context) ([]int64, error) {
	var ids []int64
	if err := aq.Select(address.FieldID).Scan(ctx, &ids); err != nil {
		return nil, err
	}
	return ids, nil
}
func (aq *AddressQuery) IDsX(ctx context.Context) []int64 {
	ids, err := aq.IDs(ctx)
	if err != nil {
		panic(err)
	}
	return ids
}