func (ifm *InvalidFieldMessage) 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 invalidfieldmessage.FieldID:
			value, ok := values[i].(*sql.NullInt64)
			if !ok {
				return fmt.Errorf("unexpected type %T for field id", value)
			}
			ifm.ID = int(value.Int64)
		case invalidfieldmessage.FieldJSON:
			if value, ok := values[i].(*[]byte); !ok {
				return fmt.Errorf("unexpected type %T for field json", values[i])
			} else if value != nil && len(*value) > 0 {
				if err := json.Unmarshal(*value, &ifm.JSON); err != nil {
					return fmt.Errorf("unmarshal field json: %w", err)
				}
			}
		}
	}
	return nil
}
assignValues assigns the values that were returned from sql.Rows (after scanning)
to the InvalidFieldMessage fields.
package ent
import (
	"encoding/json"
	"fmt"
	"strings"
	"entgo.io/contrib/entproto/internal/entprototest/ent/invalidfieldmessage"
	"entgo.io/contrib/entproto/internal/entprototest/ent/schema"
	"entgo.io/ent/dialect/sql"
)
type InvalidFieldMessage struct {
	config `json:"-"`
	ID int `json:"id,omitempty"`
	JSON *schema.SomeJSON `json:"json,omitempty"`
}
func (*InvalidFieldMessage) scanValues(columns []string) ([]interface{}, error) {
	values := make([]interface{}, len(columns))
	for i := range columns {
		switch columns[i] {
		case invalidfieldmessage.FieldJSON:
			values[i] = new([]byte)
		case invalidfieldmessage.FieldID:
			values[i] = new(sql.NullInt64)
		default:
			return nil, fmt.Errorf("unexpected column %q for type InvalidFieldMessage", columns[i])
		}
	}
	return values, nil
}