Unmarshall error
mriso79 opened this issue · 2 comments
mriso79 commented
Hi Rhino, I'm trying to make a query there, but I'm having an Unmarshall error, it displays my Struct keys but without the values ...
I made something like this:
type User struct {
ID string `json:"_id,omitempty"`
Rev string `json:"_rev,omitempty"`
Name string `json:"Name,omitempty"`
Email string `json:"Email,omitempty"`
Password string `json:"Password,omitempty"`
Doctype string `json:"Doctype,omitempty"`
Birthday string `json:"Birthday,omitempty"`
CreatedAt string `json:"CreatedAt,omitempty"`
UpdatedAt string `json:"UpdatedAt,omitempty"`
}
type ViewResult struct {
Id string `json:"id"`
Key User `json:"key"`
}
type ViewResponse struct {
TotalRows int `json:"total_rows"`
Offset int `json:"offset"`
Rows []ViewResult `json:"rows,omitempty"`
}
result := m.ViewResponse{}
//now try to query the view
err := db.GetView("users", "users", &result, nil)
Am I missing something? Thank you
mriso79 commented
Hi There! I did it,
type ViewResult struct {
Id string `json:"id"`
Key string `json:"key"`
Value User `json:"value"`
}
It was missing the Value Parameter. I will let this documented here. Thx!
rhinoman commented
Glad it was something simple!