fix parse data
This commit is contained in:
parent
99eb6e229a
commit
9e59daa977
8
model.go
8
model.go
|
@ -24,10 +24,10 @@ type User struct {
|
|||
Avatar *FilePhoto `json:"avatar"`
|
||||
}
|
||||
|
||||
func ParseToUser(data interface{}, result User) (err error) {
|
||||
func ParseToUser(data interface{}, result *User) (err error) {
|
||||
b := InterfaceToBytes(data)
|
||||
if len(b) > 0 {
|
||||
err = json.Unmarshal(b, &result)
|
||||
err = json.Unmarshal(b, result)
|
||||
} else {
|
||||
err = errors.New("[natsio.ParseUser] cannot read data")
|
||||
}
|
||||
|
@ -56,10 +56,10 @@ type FileDimensions struct {
|
|||
Medium *FileSize `json:"md"`
|
||||
}
|
||||
|
||||
func ParseToPhoto(data interface{}, result FilePhoto) (err error) {
|
||||
func ParseToPhoto(data interface{}, result *FilePhoto) (err error) {
|
||||
b := InterfaceToBytes(data)
|
||||
if len(b) > 0 {
|
||||
err = json.Unmarshal(b, &result)
|
||||
err = json.Unmarshal(b, result)
|
||||
} else {
|
||||
err = errors.New("[natsio.ParsePhoto] cannot read data")
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue