// assignValues assigns the values that were returned from sql.Rows (after scanning)
// to the FactType fields.
assignValues assigns the values that were returned from sql.Rows (after scanning)
to the FactType fields.
// assignValues assigns the values that were returned from sql . Rows ( after scanning ) // to the FactType fields .
func (ft *FactType) 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 facttype.FieldID:
			if value, ok := values[i].(*sql.NullString); !ok {
				return fmt.Errorf("unexpected type %T for field id", values[i])
			} else if value.Valid {
				ft.ID = value.String
			}
		case facttype.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 {
				ft.CreatedAt = value.Time
			}
		case facttype.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 {
				ft.UpdatedAt = value.Time
			}
		case facttype.FieldDeletedAt:
			if value, ok := values[i].(*sql.NullTime); !ok {
				return fmt.Errorf("unexpected type %T for field deleted_at", values[i])
			} else if value.Valid {
				ft.DeletedAt = new(time.Time)
				*ft.DeletedAt = value.Time
			}
		case facttype.FieldSlug:
			if value, ok := values[i].(*sql.NullString); !ok {
				return fmt.Errorf("unexpected type %T for field slug", values[i])
			} else if value.Valid {
				ft.Slug = value.String
			}
		case facttype.FieldBuiltIn:
			if value, ok := values[i].(*sql.NullBool); !ok {
				return fmt.Errorf("unexpected type %T for field built_in", values[i])
			} else if value.Valid {
				ft.BuiltIn = value.Bool
			}
		case facttype.FieldValidation:
			if value, ok := values[i].(*sql.NullString); !ok {
				return fmt.Errorf("unexpected type %T for field validation", values[i])
			} else if value.Valid {
				ft.Validation = value.String
			}
		}
	}
	return nil
}
func ( ft * FactType ) assignValues ( columns [ ] string , values [ ] interface { } ) error { if m , n := len ( values ) , len ( columns ) ; m < n { return fmt . Errorf ( " " , m , n ) } for i := range columns { switch columns [ i ] { case facttype . FieldID : if value , ok := values [ i ] . ( * sql . NullString ) ; ! ok { return fmt . Errorf ( " " , values [ i ] ) } else if value . Valid { ft . ID = value . String } case facttype . FieldCreatedAt : if value , ok := values [ i ] . ( * sql . NullTime ) ; ! ok { return fmt . Errorf ( " " , values [ i ] ) } else if value . Valid { ft . CreatedAt = value . Time } case facttype . FieldUpdatedAt : if value , ok := values [ i ] . ( * sql . NullTime ) ; ! ok { return fmt . Errorf ( " " , values [ i ] ) } else if value . Valid { ft . UpdatedAt = value . Time } case facttype . FieldDeletedAt : if value , ok := values [ i ] . ( * sql . NullTime ) ; ! ok { return fmt . Errorf ( " " , values [ i ] ) } else if value . Valid { ft . DeletedAt = new ( time . Time ) * ft . DeletedAt = value . Time } case facttype . FieldSlug : if value , ok := values [ i ] . ( * sql . NullString ) ; ! ok { return fmt . Errorf ( " " , values [ i ] ) } else if value . Valid { ft . Slug = value . String } case facttype . FieldBuiltIn : if value , ok := values [ i ] . ( * sql . NullBool ) ; ! ok { return fmt . Errorf ( " " , values [ i ] ) } else if value . Valid { ft . BuiltIn = value . Bool } case facttype . FieldValidation : if value , ok := values [ i ] . ( * sql . NullString ) ; ! ok { return fmt . Errorf ( " " , values [ i ] ) } else if value . Valid { ft . Validation = value . String } } } return nil }
assignValues assigns the values that were returned from sql.Rows (after scanning)
to the FactType fields.
assignValues assigns the values that were returned from sql . Rows ( after scanning ) to the FactType fields .