Propperly conver int to string

This commit is contained in:
itzaname 2017-01-08 02:34:03 -05:00
parent d08c31a4e6
commit b89a0e602f
2 changed files with 4 additions and 3 deletions

View File

@ -8,6 +8,7 @@ import (
"net/http"
"net/url"
"regexp"
"strconv"
)
// Item struct containing data on retrieved items
@ -181,7 +182,7 @@ func (s *Session) GetModels(user string) ([]Item, error) {
itm := obj.(map[string]interface{})
iInfo := itm["Item"].(map[string]interface{})
iCreator := itm["Creator"].(map[string]interface{})
Data = append(Data, Item{"", string(int(iInfo["AssetId"].(float64))), "", string(int(iCreator["Id"].(float64))), iCreator["Name"].(string), "Model", iInfo["Name"].(string), false, true})
Data = append(Data, Item{"", strconv.Itoa(int(iInfo["AssetId"].(float64))), "", strconv.Itoa(int(iCreator["Id"].(float64))), iCreator["Name"].(string), "Model", iInfo["Name"].(string), false, true})
}
return Data, nil

View File

@ -48,10 +48,10 @@ func (s *Session) GetInbox() ([]Message, error) {
sender := msg["Sender"].(map[string]interface{})
message := Message{}
message.ID = string(int(msg["Id"].(float64)))
message.ID = strconv.Itoa(int(msg["Id"].(float64)))
message.Subject = msg["Subject"].(string)
message.Body = msg["Body"].(string)
message.FromID = string(int(sender["UserId"].(float64)))
message.FromID = strconv.Itoa(int(sender["UserId"].(float64)))
message.FromName = sender["UserName"].(string)
messages = append(messages, message)
}