func (po *Portal) 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 portal.FieldID:
			value, ok := values[i].(*sql.NullInt64)
			if !ok {
				return fmt.Errorf("unexpected type %T for field id", value)
			}
			po.ID = int(value.Int64)
		case portal.FieldName:
			if value, ok := values[i].(*sql.NullString); !ok {
				return fmt.Errorf("unexpected type %T for field name", values[i])
			} else if value.Valid {
				po.Name = value.String
			}
		case portal.FieldDescription:
			if value, ok := values[i].(*sql.NullString); !ok {
				return fmt.Errorf("unexpected type %T for field description", values[i])
			} else if value.Valid {
				po.Description = value.String
			}
		case portal.ForeignKeys[0]:
			if value, ok := values[i].(*sql.NullInt64); !ok {
				return fmt.Errorf("unexpected type %T for edge-field portal_category", value)
			} else if value.Valid {
				po.portal_category = new(int)
				*po.portal_category = int(value.Int64)
			}
		}
	}
	return nil
}
assignValues assigns the values that were returned from sql.Rows (after scanning)
to the Portal fields.
package ent
import (
	"fmt"
	"strings"
	"entgo.io/contrib/entproto/internal/entprototest/ent/category"
	"entgo.io/contrib/entproto/internal/entprototest/ent/portal"
	"entgo.io/ent/dialect/sql"
)
type Portal struct {
	config `json:"-"`
	ID int `json:"id,omitempty"`
	Name string `json:"name,omitempty"`
	Description string `json:"description,omitempty"`
	Edges           PortalEdges `json:"edges"`
	portal_category *int
}
type PortalEdges struct {
	Category *Category `json:"category,omitempty"`
	loadedTypes [1]bool
}
func (e PortalEdges) CategoryOrErr() (*Category, error) {
	if e.loadedTypes[0] {
		if e.Category == nil {
			return nil, &NotFoundError{label: category.Label}
		}
		return e.Category, nil
	}
	return nil, &NotLoadedError{edge: "category"}
}
func (*Portal) scanValues(columns []string) ([]interface{}, error) {
	values := make([]interface{}, len(columns))
	for i := range columns {
		switch columns[i] {
		case portal.FieldID:
			values[i] = new(sql.NullInt64)
		case portal.FieldName, portal.FieldDescription:
			values[i] = new(sql.NullString)
		case portal.ForeignKeys[0]:  
			values[i] = new(sql.NullInt64)
		default:
			return nil, fmt.Errorf("unexpected column %q for type Portal", columns[i])
		}
	}
	return values, nil
}