func (u *User) QueryAddresses() *AddressQuery {
	return (&UserClient{config: u.config}).QueryAddresses(u)
}
QueryAddresses queries the "addresses" edge of the User entity.
package ent
import (
	"fmt"
	"strings"
	"time"
	"entgo.io/ent/dialect/sql"
	"github.com/go-kratos/beer-shop/app/user/service/internal/data/ent/user"
)
type User struct {
	config `json:"-"`
	ID int64 `json:"id,omitempty"`
	Username string `json:"username,omitempty"`
	PasswordHash string `json:"password_hash,omitempty"`
	CreatedAt time.Time `json:"created_at,omitempty"`
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	Edges UserEdges `json:"edges"`
}
type UserEdges struct {
	Addresses []*Address `json:"addresses,omitempty"`
	Cards []*Card `json:"cards,omitempty"`
	loadedTypes [2]bool
}
func (e UserEdges) AddressesOrErr() ([]*Address, error) {
	if e.loadedTypes[0] {
		return e.Addresses, nil
	}
	return nil, &NotLoadedError{edge: "addresses"}
}
func (e UserEdges) CardsOrErr() ([]*Card, error) {
	if e.loadedTypes[1] {
		return e.Cards, nil
	}
	return nil, &NotLoadedError{edge: "cards"}
}
func (*User) scanValues(columns []string) ([]interface{}, error) {
	values := make([]interface{}, len(columns))
	for i := range columns {
		switch columns[i] {
		case user.FieldID:
			values[i] = &sql.NullInt64{}
		case user.FieldUsername, user.FieldPasswordHash:
			values[i] = &sql.NullString{}
		case user.FieldCreatedAt, user.FieldUpdatedAt:
			values[i] = &sql.NullTime{}
		default:
			return nil, fmt.Errorf("unexpected column %q for type User", columns[i])
		}
	}
	return values, nil
}
func (u *User) assignValues(columns []string, values []interface{}) error {
	if m, n := len(values), len(columns); m < n {
		return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
	}
	for i := range columns {
		switch columns[i] {
		case user.FieldID:
			value, ok := values[i].(*sql.NullInt64)
			if !ok {
				return fmt.Errorf("unexpected type %T for field id", value)
			}
			u.ID = int64(value.Int64)
		case user.FieldUsername:
			if value, ok := values[i].(*sql.NullString); !ok {
				return fmt.Errorf("unexpected type %T for field username", values[i])
			} else if value.Valid {
				u.Username = value.String
			}
		case user.FieldPasswordHash:
			if value, ok := values[i].(*sql.NullString); !ok {
				return fmt.Errorf("unexpected type %T for field password_hash", values[i])
			} else if value.Valid {
				u.PasswordHash = value.String
			}
		case user.FieldCreatedAt:
			if value, ok := values[i].(*sql.NullTime); !ok {
				return fmt.Errorf("unexpected type %T for field created_at", values[i])
			} else if value.Valid {
				u.CreatedAt = value.Time
			}
		case user.FieldUpdatedAt:
			if value, ok := values[i].(*sql.NullTime); !ok {
				return fmt.Errorf("unexpected type %T for field updated_at", values[i])
			} else if value.Valid {
				u.UpdatedAt = value.Time
			}
		}
	}
	return nil
}